Android无法计算哈希错误

时间:2015-10-13 16:15:49

标签: java android

运行assembleRelease时遇到问题。这是堆栈跟踪:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageRelease'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.tooling.BuildException: Unable to compute hash of C:\Users\murphyaa\Documents\Android-nsb\app\build\intermediates\classes-proguard\release\classes.jar
        at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:226)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:79)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 14 more
Caused by: com.android.builder.packaging.PackagerException: Unable to compute hash of C:\Users\murphyaa\Documents\Android-nsb\app\build\intermediates\classes-proguard\release\classes.jar
        at com.android.builder.core.AndroidBuilder.packageApk(AndroidBuilder.java:1808)
        at com.android.build.gradle.tasks.PackageApplication.doFullTaskAction(PackageApplication.java:206)
        ... 22 more

我试图做一些挖掘并认为它与proguard有关但不是100%肯定。上面是附加的--stacktrace,而且没有:

:app:generateReleaseSources
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJavaWithJavac UP-TO-DATE
:app:compileRetrolambdaRelease UP-TO-DATE
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources UP-TO-DATE
:app:proguardRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:crashlyticsStoreDeobsRelease
:app:crashlyticsUploadDeobsRelease
:app:validateReleaseSigning
:app:packageRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> Unable to compute hash of C:\Users\murphyaa\Documents\Android-nsb\app\build\intermediates\classes-proguard\release\classes.jar

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

任何人都可以提供帮助 感谢

1 个答案:

答案 0 :(得分:0)

经过一些调查后我发现我需要在我的proguard文件中添加以下行:

-dontwarn java.lang.invoke**

希望这有助于其他有同样问题的人