Voici mon fichier build.gradle (Module: app):
apply plugin: 'com.Android.application'
Android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
applicationId "com.doctor.ciao"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.Android.support:appcompat-v7:26.1.0'
compile 'com.Android.support:design:26.1.0'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'com.github.devlight.pulseview:library:1.0.2'
compile 'commons-io:commons-io:2.4'
compile 'com.github.lguipeng:BubbleView:1.0.1'
}
Je reçois deux erreurs:
Erreur: Java.util.concurrent.ExecutionException: com.Android.tools.aapt2.Aapt2Exception: erreur AAPT
Erreur: L'exécution a échoué pour la tâche ': app: mergeDebugResources'.
Erreur: Java.util.concurrent.ExecutionException: com.Android.tools.aapt2.Aapt2Exception: erreur AAPT
J'ai déjà ajouté "Android.enableAapt2=false"
au fichier gradle.properties mais l'erreur persiste. S'il vous plaît aidez-moi avec ce problème. Je vous remercie
Mon problème était que j'avais un fichier png invalide - j'avais un fichier .jpg qui avait été renommé par accident avec l'extension .png
Pour rechercher le fichier image incriminé, j'ai exécuté cette commande dans mon répertoire d'application:
find . -type f -name "*.png" | xargs -L 1 -I{} file -I {} | grep -v 'image/png; charset=binary$'
Renommer le fichier image en une extension .jpg a résolu le problème et je pouvais le reconstruire.
J'ai eu la même erreur après avoir utilisé Android 3 et SDK 25.
Changer la version du SDK de 25 à 27 a aidé.
Le ci-dessous est mon build.gradle. Je pourrais recréer cela en modifiant la version du SDK de 27 à 25.
J'espère que cela t'aides.
compileSdkVersion 27
targetSdkVersion 27
TRACE DE LA PILE
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'. at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:100)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
at
org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.Java:51)
at
org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:62)
at
org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
at
org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:60)
at
org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:97)
at
org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.Java:87)
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:199)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
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:123)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:79)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:104)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:98)
at
org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:626)
at
org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:581)
at
org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:98)
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:
org.gradle.tooling.BuildException: Failed to execute aapt at
com.Android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.Java:513)
at
com.Android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.Java:248)
at
com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:106)
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.IncrementalTaskAction.doExecute(IncrementalTaskAction.Java:46)
at
org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:39)
at
org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.Java:26)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:121)
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:199)
at
org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:110)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:110)
at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
... 32 more Suppressed: Java.lang.RuntimeException: Some file
processing failed, see logs for details at
com.Android.builder.internal.aapt.QueuedResourceProcessor.waitForAll(QueuedResourceProcessor.Java:121)
at
com.Android.builder.internal.aapt.QueuedResourceProcessor.end(QueuedResourceProcessor.Java:141)
at
com.Android.builder.internal.aapt.v2.QueueableAapt2.close(QueueableAapt2.Java:115)
at
com.Android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.Java:293)
... 48 more Caused by:
com.Android.ide.common.process.ProcessException: Failed to execute
aapt at
com.Android.builder.core.AndroidBuilder.processResources(AndroidBuilder.Java:794)
at
com.Android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.Java:491)
... 49 more Caused by: Java.util.concurrent.ExecutionException:
Java.util.concurrent.ExecutionException:
com.Android.builder.internal.aapt.v2.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:792)
... 50 more Caused by: Java.util.concurrent.ExecutionException:
com.Android.builder.internal.aapt.v2.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:177)
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.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error:
check logs for details at
com.Android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.Java:463)
at
com.Android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.Java:415)
at
com.Android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.Java:332)
at
com.Android.utils.GrabProcessOutput$1.run(GrabProcessOutput.Java:104)
Merci beaucoup. Je suis suivre le commentaire de @Anubhav Sarangi ci-dessous:
Certaines des images de mon dossier pouvant être dessiné ont été renommées automatiquement en "imagename.9.png". Donc, il montrait une erreur - 9 erreur d’image patch. En renommant les images en "imagename.png", le problème a été résolu.
je vérifie les images dans mon dossier pouvant être dessiné, et j’y trouve une image qui n’est pas une image de 9 correctifs, mais nommée imagename.9.png, et je le renomme en imagename.png, le problème est résolu.
il y a un lieu, il faut ajouter "Android.enableAapt2 = false" à gradle.properties
merci encore @Anubhav Sarangi et @Eugen Pechanec
ce sont mes astuces d'erreurdans cette image, le title_bar.9.png n'est pas une image de 9 correctifs; je le renomme donc title_bar.png et j'ajoute Android.enableAapt2 = false à gradle.properties, puis cliquez sur "Sync Now" et le problème résolu