web-dev-qa-db-fra.com

Impossible de compiler sous Android Studio 3.0 Canary 1

J'essaie de compiler mon projet Android sous AS 3.0 Canary 1 (cela fonctionne correctement sous AS 2.3.2 version stable) mais j'ai échoué avec l'erreur suivante:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageInstantRunResourcesUatGoogleDebug'.
> com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageInstantRunResourcesUatGoogleDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:98)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:68)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:60)
    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.execute(DefaultTaskGraphExecuter.Java:248)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.Java:239)
    at org.gradle.internal.Transformers$4.transform(Transformers.Java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:114)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:68)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:239)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:226)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:120)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:77)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:101)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:95)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:527)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:95)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.Java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
Caused by: org.gradle.tooling.BuildException: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
    at com.Android.build.gradle.internal.scope.SplitScope.lambda$parallelForEachOutput$10(SplitScope.Java:243)
    at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:238)
    at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:198)
    at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:182)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.doFullTaskAction(PackageAndroidArtifact.Java:301)
    at com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:80)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.Java:161)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:132)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.Java:115)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.Java:109)
    at org.gradle.internal.Transformers$4.transform(Transformers.Java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:114)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:63)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:109)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:90)
    ... 26 more
Caused by: Java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
    at com.Android.apkzlib.Zip.ZFile.createSources(ZFile.Java:1586)
    at com.Android.apkzlib.Zip.ZFile.makeStoredEntry(ZFile.Java:1546)
    at com.Android.apkzlib.Zip.ZFile.add(ZFile.Java:1625)
    at com.Android.apkzlib.zfile.ApkZFileCreator.writeFile(ApkZFileCreator.Java:141)
    at com.Android.builder.internal.packaging.IncrementalPackager.updateFiles(IncrementalPackager.Java:170)
    at com.Android.builder.internal.packaging.IncrementalPackager.updateAssets(IncrementalPackager.Java:229)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.doTask(PackageAndroidArtifact.Java:525)
    at com.Android.build.gradle.tasks.PackageAndroidArtifact.splitFullAction(PackageAndroidArtifact.Java:359)
    at com.Android.build.gradle.internal.scope.SplitScope.lambda$parallelForEachOutput$6(SplitScope.Java:187)
    at com.Android.build.gradle.internal.scope.SplitScope.lambda$parallelForEachOutput$7(SplitScope.Java:204)
    at com.Android.build.gradle.internal.scope.SplitScope.lambda$null$8(SplitScope.Java:226)
    at com.Android.ide.common.internal.WaitableExecutor.waitForAllTasks(WaitableExecutor.Java:215)
    at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:237)
    ... 41 more
    Suppressed: Java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
        at com.Android.apkzlib.Zip.ZFile.createSources(ZFile.Java:1586)
        at com.Android.apkzlib.Zip.ZFile.makeStoredEntry(ZFile.Java:1546)
        at com.Android.apkzlib.Zip.ZFile.add(ZFile.Java:1625)
        at com.Android.apkzlib.Zip.ZFile.add(ZFile.Java:1499)
        at com.Android.apkzlib.sign.ManifestGenerationExtension.updateManifest(ManifestGenerationExtension.Java:241)
        at com.Android.apkzlib.sign.ManifestGenerationExtension.access$000(ManifestGenerationExtension.Java:52)
        at com.Android.apkzlib.sign.ManifestGenerationExtension$1.lambda$beforeUpdate$0(ManifestGenerationExtension.Java:168)
        at com.Android.apkzlib.Zip.ZFile.notify(ZFile.Java:2099)
        at com.Android.apkzlib.Zip.ZFile.update(ZFile.Java:871)
        at com.Android.apkzlib.Zip.ZFile.close(ZFile.Java:1161)
        at com.Android.apkzlib.zfile.ApkZFileCreator.close(ApkZFileCreator.Java:172)
        at com.google.common.io.Closer.close(Closer.Java:213)
        at com.Android.builder.internal.packaging.IncrementalPackager.close(IncrementalPackager.Java:330)
        at com.Android.build.gradle.tasks.PackageAndroidArtifact.doTask(PackageAndroidArtifact.Java:535)
        at com.Android.build.gradle.tasks.PackageAndroidArtifact.splitFullAction(PackageAndroidArtifact.Java:359)
        at com.Android.build.gradle.internal.scope.SplitScope.lambda$parallelForEachOutput$6(SplitScope.Java:187)
        at com.Android.build.gradle.internal.scope.SplitScope.lambda$parallelForEachOutput$7(SplitScope.Java:204)
        at com.Android.build.gradle.internal.scope.SplitScope.lambda$null$8(SplitScope.Java:226)
        at Java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.Java:1424)
        at Java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.Java:289)
        at Java.util.concurrent.ForkJoinTask.externalAwaitDone(ForkJoinTask.Java:326)
        at Java.util.concurrent.ForkJoinTask.doJoin(ForkJoinTask.Java:391)
        at Java.util.concurrent.ForkJoinTask.join(ForkJoinTask.Java:719)
        at com.Android.ide.common.internal.WaitableExecutor.waitForAllTasks(WaitableExecutor.Java:215)
        at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:237)
        at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:198)
        at com.Android.build.gradle.internal.scope.SplitScope.parallelForEachOutput(SplitScope.Java:182)
        at com.Android.build.gradle.tasks.PackageAndroidArtifact.doFullTaskAction(PackageAndroidArtifact.Java:301)
        at com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:80)
        at Sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)
        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:161)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:132)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:121)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.Java:115)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.Java:109)
        at org.gradle.internal.Transformers$4.transform(Transformers.Java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:114)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:63)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:109)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:90)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:68)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:60)
        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.execute(DefaultTaskGraphExecuter.Java:248)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.Java:239)
        at org.gradle.internal.Transformers$4.transform(Transformers.Java:169)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:114)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:68)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:239)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:226)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:120)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:77)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:101)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:95)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:527)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:95)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.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)


BUILD FAILED in 2s
18 actionable tasks: 6 executed, 12 avoided (67%)

Je ne sais pas si cela est lié à la bibliothèque Gava 19.0 que j'ai importée. Les bibliothèques que j'ai utilisées sont énumérées ci-dessous:

dependencies {
    compile fileTree(include: ['*.jar'], excludes: ["pushservice-${baiduLibVersion}.jar", 'native-libs.jar'], dir: 'libs')
    androidTestCompile('com.Android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })
    compile("com.Android.support:appcompat-v7:${supportLibVersion}") {
        exclude module: 'support-v4'
    }
    compile "com.Android.support:support-fragment:${supportLibVersion}"
    compile "com.Android.support:design:${supportLibVersion}"
    compile "com.Android.support:percent:${supportLibVersion}"
    compile "com.Android.support:gridlayout-v7:${supportLibVersion}"
    compile "com.google.Android.gms:play-services-analytics:${playServiceLibVersion}"

    compile "com.google.firebase:firebase-messaging:${playServiceLibVersion}"
    // Cloud Messaging and Notifications
    compile "com.google.firebase:firebase-crash:${playServiceLibVersion}"
    compile "com.google.firebase:firebase-appindexing:${playServiceLibVersion}"
    compile "com.google.Android.gms:play-services-auth:${playServiceLibVersion}"
    // google account login
    compile "com.google.Android.gms:play-services-location:${playServiceLibVersion}"

    compile('com.github.AndroidDeveloperLB:AutoFitTextView:3') {
        exclude group: 'com.Android.support', module: 'appcompat-v7'
    }
    compile('com.github.ksoichiro:Android-observablescrollview:1.6.0') {
        exclude group: 'com.Android.support', module: 'recyclerview-v7'
    }
    compile('com.bignerdranch.Android:expandablerecyclerview:2.1.1') {
        exclude group: 'com.Android.support', module: 'recyclerview-v7'
    }
    compile('com.facebook.Android:facebook-Android-sdk:4.13.2') {
        exclude group: 'com.Android.support', module: 'support-v4'
    }
    compile 'com.Android.support:multidex:1.0.1'
    compile 'in.co.ophio:secure-preferences:0.1.3'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.google.code.gson:gson:2.7'
    compile 'com.google.dagger:dagger:2.7'
    compile 'com.squareup.phrase:phrase:1.1.0'
    compile 'org.Apache.commons:commons-lang3:3.4'
    compile 'javax.annotation:javax.annotation-api:1.2'
    compile 'uk.co.chrisjenx:calligraphy:2.2.0'
    compile 'com.githang:com-phillipcalvin-iconbutton:2.0.2'
    compile 'com.github.seanzor:shared-preferences-helper:1.1.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@jar'
    compile 'com.github.aakira:expandable-layout:1.6.0@aar'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'org.parceler:parceler-api:1.1.5'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.1.6'
    compile 'com.Android.support.constraint:constraint-layout:1.0.2'
    compile 'org.apmem.tools:layouts:1.10@aar'
    compile 'com.bigkoo:pickerview:2.1.1'
    compile 'com.newrelic.agent.Android:android-agent:5.7.1'
    compile 'com.google.guava:guava:19.0'
    compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.1'
    compile 'com.vdurmont:semver4j:2.0.2'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
    annotationProcessor 'org.parceler:parceler:1.1.5'
    checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
}
15
David Cheung

L’équipe de Firebase a suggéré d’utiliser ceci comme solution:

classpath ('com.google.firebase:firebase-plugins:1.1.0') {
    exclude group: 'com.google.guava', module: 'guava-jdk5'
}

EDIT: Le nouveau package mis à jour sera automatiquement exclu du package guava-jdk5.

classpath 'com.google.firebase:firebase-plugins:1.1.1'
27
Mohamed ALOUANE

J'ai exactement le même problème lorsque j'ai créé un nouveau projet et ajouté les lignes une par une.

La ligne qui causait le problème est 

classpath 'com.google.firebase:firebase-plugins:1.1.0'

c'était dans le fichier build.gradle du projet. Supprimer cette ligne résout le problème.

2
Amine Bou

Le problème est le nouveau plugin Android version 3.0.0-alpha1 

Il suffit de revenir au plugin en 2.3 ou 2.4-alpha7 et d’utiliser gradle 3.5, cela fonctionnera avec le plugin Firebase

2
Michael B.

Autre que firebase si vous avez un autre script de construction (peut-être des scripts de construction personnalisés) utilisant la bibliothèque Guava, vous devez le mettre à niveau vers guava:21:0 ou en exclure le type de goyave.

1
Hossein Shahdoost

L'erreur "Exécution échouée pour la tâche" qui commence par Android Studio 2.4 et maintenant 3.0 canary s'exécute sur mon ordinateur Win7. Ce qui semble m'aider est d’exécuter le Gestionnaire des tâches, puis de supprimer le processus Java.exe. La construction passe ensuite proprement pour moi.

0
Jim Andreas