J'ai développé une application Linphone mais je suis resté coincé au-dessous de ce point. J'ai changé le nom de l'application et refactored tous les packages relatifs. L'application était ok jusqu'à ce que je mette à niveau gradle vers 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.
J'ai lu d'autres questions sur l'impossibilité de trouver une erreur d'attribut, mais je n'ai pas trouvé de réponse. J'ai essayé les méthodes ci-dessous mais aucune d'entre elles n'a fonctionné:
Ci-dessous les détails pour le journal:
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)
Pour résoudre ce problème, vous devriez:
build.gradle
, vous devez définir compileSdkVersion
sur 27 et modifier la version de com.Android.support:appcompat-v7
pour qu'elle corresponde à la version de com.Android.support:recyclerview-v7:
(ou de l'autre composant de la bibliothèque de support utilisé) (27.0.0)UPD:
Si pour une raison quelconque cela ne vous aide pas, voyez le commentaire ci-dessous par @madu
J'ai pu résoudre ce problème en mettant à jour les valeurs suivantes à «27»:
Android {
compiledSdkVersion 27
defaultConfig {
targetSdkVersion 27
}
}
J'ai résolu ce problème en mettant à jour targetSdkVersion et compileSdkVersion.
targetSdkVersion 28
compileSdkVersion 28
J'essayais de rétrograder targetSdkVersion et compileSdkVersion 27 à 25, mais cette erreur est survenue lorsque j'ai trouvé une solution et que cela fonctionnait très bien
je viens juste d'ajouter la ligne de code ci-dessous dans mon fichier de classement
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.Android.support') {
details.useVersion '25.2.0'
}
}
}
si vous voulez rétrograder de 27 à 23,24,25, etc. que de modifier la details.useVersion '_._._' <- mettez ici la version précédente
Après la rétrogradation de la v4: 27.0.1 à 25.3.1, d'accord. Il y avait 11 erreurs dans les fichiers de res avant.
J'ai pu résoudre ce problème en mettant à jour les valeurs suivantes de "25" à "27":
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.Android.tools.build:gradle:3.1.2'
}
}
apply plugin: 'com.Android.application'
repositories {
jcenter()
google()
}
dependencies {
implementation "com.Android.support:support-v4:27.0.2"
implementation "com.Android.support:support-v13:27.0.2"
implementation "com.Android.support:cardview-v7:27.0.2"
implementation "com.Android.support:appcompat-v7:27.0.2"
implementation 'com.Android.support:recyclerview-v7:25.0.1'
implementation 'com.Android.support:design:25.0.1'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
Android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 24
targetSdkVersion 27
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
dirs.each { dir ->
Java.srcDirs "src/${dir}/Java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.Java.srcDirs = ['tests/src']
}
}
C'est juste un problème de cache. Le contenu est mis à jour dans les fichiers de cache.
Supprimez le dossier "support-compat-27.0.0.aar" de C: /USER/nom_utilisateur/.gradle/caches/transforms-1/files-1.1/support-compat-27.0.0.aar/...
Remarque: Accédez au chemin qui s’est affiché par erreur.
Construisez le projet.
Cela résoudra votre problème.
J'ai fait face au même problème et je ne l'ai pas encore résolu. Le problème est la version de dépendance com.Android.support:support-v13 ou v7 (éventuellement support-combat) S'il s'agit de 23.0.0 ou 24.0.0, il n'y a pas de problème, mais si vous définissez 27.0.0, l'erreur est générée.