无法在Android Studio 3.0 Canary 1下编译

时间:2017-05-22 03:49:22

标签: android android-studio android-studio-3.0

我尝试在AS 3.0 Canary 1下编译我的Android项目(它在AS 2.3.2稳定版上运行正常)但失败并出现以下错误:

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%)

我不确定这是否与我导入的guava 19.0库有关。我使用的库如下:

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'
}

5 个答案:

答案 0 :(得分:27)

Firebase团队已建议将其用作修复程序:

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

编辑: 包括新更新的软件包将自动排除guava-jdk5软件包。

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

答案 1 :(得分:2)

当我创建一个新项目并逐个添加这些行时,我遇到了完全相同的问题。

造成问题的一行是

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

在项目build.gradle文件中。删除该行可以解决问题。

答案 2 :(得分:2)

问题是新的Android插件版本3.0.0-alpha1

只需将插件还原为2.3或2.4-alpha7并使用gradle 3.5,它将与Firebase插件一起使用

答案 3 :(得分:1)

除了firebase之外,如果您有任何其他构建脚本(可能是自定义构建脚本),那么使用Guava库您必须将其升级到guava:21:0或从中排除番石榴

答案 4 :(得分:0)

我看到“执行失败的任务”错误从Android Studio 2.4开始,现在我的Win7 PC上运行3.0 canary。对我来说似乎有用的是运行任务管理器然后终止java.exe进程。在我之后,构建完全贯穿其中。