本文介绍了无法找到属性android:font for v7的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个Linphone应用程序,但陷入了低谷。我更改了应用程序名称并重构了所有相关的包。该应用程序是好的,直到我升级到3.0.0的Gradle。

  AGPBI:{kind:error,text:error:resource android:attr / fontStyle not found 。  源 :[{ 文件 : 〜/ .gradle /高速缓存/变换-1 /文件-1.1 /支撑COMPAT-27.0.0.aar / 61646c6d4479aff22f7047873e2edd7d / RES /值/ values.xml, 位置:{ STARTLINE:20, STARTCOLUMN:4 开始偏移:1254, ENDCOLUMN:69, endOffset:1319}}], 原: , 工具: AAPT} 
AGPBI:{kind:error,text:error:resource android:attr / font not found。,sources:[{file:〜/ gradle这个/高速缓存/变换-1 /文件-1.1 /支撑COMPAT-27.0.0.aar / 61646c6d4479aff22f7047873e2edd7d / RES /值/ values.xml, 位置:{ STARTLINE:20, STARTCOLUMN:4, startOffset:1254,endColumn:69,endOffset:1319}}],original:,tool:AAPT}
AGPBI:{kind:error ,text:error:resource android:attr / fontWeight not found。,sources:[{file:〜/ .gradle / caches / transforms-1 / files-1.1 / support-compat-27.0 .0.aar / 61646c6d4479aff22f7047873e2edd7d / RES /值/ values.xml, 位置:{ STARTLINE:20, STARTCOLUMN:4 ,startOffset:1254,endColumn:69,endOffset:1319}}],original:,tool:AAPT}
〜/ app-name / bin / intermediates /incremental/mergeDebugResources/merged.dir/values/values.xml:149:error:resource android:attr / fontStyle not found。
〜/ appname / bin / intermediates / incremental / mergeDebugResources / merged.dir / values / values.xml:149:error:resource android:attr / font not found。
〜/ appname / bin / intermediates / incremental / mergeDebugResources / merged.dir / values / values.xml:149:error:resource android:attr / fontWeight not found。
错误:链接引用失败。

我已阅读其他有关无法找到属性错误但无法找到答案的问题。我尝试了下面的方法,但都没有工作:
$ b


  1. 删除应用程序的bin目录

  2. 清理缓存并重新构建应用程序

  3. 使缓存无效并重新启动(每个选项都在其中)

  4. 更改sdk版本(api)
  5. >
  6. multiDexEnabled true / false

以下是日志的详细信息:

 无法执行aapt 
com.android.ide.common.process.ProcessException:无法在com.android.builder执行aapt
。 core.AndroidBuilder.processResources(AndroidBuilder.java:793)
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:566)
at com.android.build.gradle。 tasks.ProcessAndroidResources.doFullTask​​Action(ProcessAndroidResources.java:293)
处sun.reflect.NativeMethodAccessorImpl com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:109)
。 invoke0(母语法)在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62

在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
在java.lang.reflect中.Method.invoke(Method.java:498)
org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory .DefaultTaskClassInfoStore $ IncrementalTask​​Action.doExecute(DefaultTaskClassInfoStore.java:173)
在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
在org.gradle .api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:122)
在org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.ex ecute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute( DefaultBuildOperationExecutor.java:197)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction( ExecuteActionsTaskExecuter.java:111)
位于org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
位于org.gradle.api.internal.tasks.execution。 ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
。在org.gradle.api.internal。 tasks.execution.ResolveTaskOutputC achingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
。在org.gradle.api.internal。 tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle。 api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
。在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
在org.gradle.execution.tas kgraph.DefaultTaskGraphExeter $ $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal .progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress .DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTask PlanExecutor.java:124)
。在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access $ 200(DefaultTaskPlanExecutor.java:80)
。在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ $ TaskExecutorWorker 1执行(DefaultTaskPlanExecutor.java:105)
在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:99)$ b $在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute b (DefaultTaskExecutionPlan.java:625)在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)

。在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor .java:99)
at org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl。 java:46)
在java.util。并发.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)$ b $在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)$ b $在java.lang.Thread.run(Thread.java:745)
引起:java.util.concurrent.ExecutionException:java.util.concurrent。 ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:查看详细信息
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
at com .google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
,位于com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:791)
... 48 more
引起:java.util.concurrent.ExecutionException:com.android.tools.aapt2 .Aapt2Excepti on:AAPT2错误:查看详细信息
,位于com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
com.google.common.util.concurrent.AbstractFuture .get(AbstractFuture.java:462)
at com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79)
at com.android.builder.internal.aapt .v2.QueueableAapt2.lambda $ makeValidatedPackage $ 1(QueueableAapt2.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
... 1 more
导致:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:查看详细信息
at com。 android.builder.png.AaptProcess $ NotifierProcessOutput.handleOutput(AaptProcess.java:454)
at com.android.builder.png.AaptProcess $ NotifierProcessOutput.err(AaptProcess.java:411)
at com。 android.builder.png.AaptProcess $ PROC essOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput $ 1.run(GrabProcessOutput.java:104)


解决方案

要解决此问题,您应该: 在模块的 build.gradle 中,您应该设置 compileSdkVersion 改为27,并更改 com.android.support:appcompat-v7 版本以匹配 com.android.support:recyclerview-v7 :(或您使用的其他支持库组件)版本(27.0.0)

UPD:



如果由于某些原因它不能帮助您,请参阅下面的注释 @madu


I've been developing a Linphone application but got stuck in below point. I've changed the app name and refactored all relative packages. The application was ok until I upgrade gradle to 3.0.0.

AGPBI: {"kind":"error","text":"error: resource android:attr/fontStyle not found.","sources":[{"file":"~/.gradle/caches/transforms-1/files-1.1/support-compat-27.0.0.aar/61646c6d4479aff22f7047873e2edd7d/res/values/values.xml","position":{"startLine":20,"startColumn":4,"startOffset":1254,"endColumn":69,"endOffset":1319}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource android:attr/font not found.","sources":[{"file":"~/.gradle/caches/transforms-1/files-1.1/support-compat-27.0.0.aar/61646c6d4479aff22f7047873e2edd7d/res/values/values.xml","position":{"startLine":20,"startColumn":4,"startOffset":1254,"endColumn":69,"endOffset":1319}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: resource android:attr/fontWeight not found.","sources":[{"file":"~/.gradle/caches/transforms-1/files-1.1/support-compat-27.0.0.aar/61646c6d4479aff22f7047873e2edd7d/res/values/values.xml","position":{"startLine":20,"startColumn":4,"startOffset":1254,"endColumn":69,"endOffset":1319}}],"original":"","tool":"AAPT"}
~/app-name/bin/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:149: error: resource android:attr/fontStyle not found.
~/appname/bin/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:149: error: resource android:attr/font not found.
~/appname/bin/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:149: error: resource android:attr/fontWeight not found.
error: failed linking references.

I've read other questions about unable to find attribute error but could not find an answer. I've tried below methods but none of them worked:

  1. delete bin/ directory of the app
  2. clean cache and rebuild the app again
  3. Invalidate cache and restart (every options in it)
  4. Changing sdk version (api)
  5. multiDexEnabled true/false

Below is detail for log :

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:793)
    at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:566)
    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:293)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:791)
    ... 48 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
    at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    ... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:454)
    at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:411)
    at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
    at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
解决方案

To solve this problem you should:

  1. Install the mathching SDK version (27)
  2. In module's build.gradle you should set compileSdkVersion to 27 and change the com.android.support:appcompat-v7 version to match the com.android.support:recyclerview-v7: (or the other support library component that you use) version (27.0.0)

UPD:

If for some reason it doesn't help you, see the comment below by @madu

这篇关于无法找到属性android:font for v7的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 14:30