2016-03-12 136 views
6

我試圖讓我簽字發佈的應用程序,並建立正確的,但我想啓用Proguard我收到以下錯誤錯誤:執行失敗的任務「:應用程序:transformClassesAndResourcesWithProguardForRelease

Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease 

我gradle這個文件

buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    lintOptions { 
     disable 'InvalidPackage' 
    } 
    packagingOptions { 
     exclude 'META-INF/services/javax.annotation.processing.Processor' 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 
    } 
} 

repositories { 
    mavenCentral() 
    jcenter() 
    maven { 
     url 'https://esri.bintray.com/arcgis' 
    } 
} 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile project(':StickyListHeaders') 
    compile files('libs/org.apache.commons.io.jar') 
    compile files('libs/json-20140107.jar') 
    compile project(':ParallaxEverywhere') 
    compile files('libs/nineoldandroids-2.4.0.jar') 
    compile files('libs/gson-2.5.jar') 
    compile project(':FlowLayout') 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile 'com.android.support:support-v4:23.2.0' 
    compile 'com.android.support:recyclerview-v7:23.2.0' 
    compile 'com.android.support:cardview-v7:23.2.0' 
    compile 'com.esri.arcgis.android:arcgis-android:10.2.7' 
    compile 'jp.wasabeef:blurry:1.0.5' 
    compile 'com.github.bumptech.glide:glide:3.6.1' 
    compile 'com.makeramen:roundedimageview:2.2.1' 
    compile 'com.daimajia.easing:library:[email protected]' 
    compile 'com.daimajia.androidanimations:library:[email protected]' 
    compile 'org.apache.commons:commons-lang3:3.1' 
    compile 'com.lifeofcoding:cacheutilslibrary:[email protected]' 
    compile 'com.edmodo:rangebar:1.0.0' 

} 

和我ProGuard的規則文件

-keep class butterknife.** { *; } 
-dontwarn butterknife.internal.** 
-keep class **$$ViewBinder { *; } 

-keepclasseswithmembernames class * { 
    @butterknife.* <fields>; 
} 

-keepclasseswithmembernames class * { 
    @butterknife.* <methods>; 
} 

,這裏是堆棧跟蹤

Exception is: 
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. 
     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:52) 
     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.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) 
     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) 
     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) 
     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) 
     at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) 
     at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) 
     at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) 
     at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) 
     at org.gradle.internal.Factories$1.create(Factories.java:22) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) 
     at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) 
     at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) 
     at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) 
     at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) 
     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) 
     at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) 
     at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) 
     at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) 
     at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) 
     at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) 
     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) 
     at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) 
     at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48) 
     at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51) 
     at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28) 
     at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) 
     at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170) 
     at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) 
     at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) 
     at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) 
     at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) 
     at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) 
     at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) 
     at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 
     at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 
     at org.gradle.launcher.Main.doAction(Main.java:33) 
     at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 
     at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) 
     at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) 
     at org.gradle.launcher.GradleMain.main(GradleMain.java:23) 
     at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) 
     at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) 
     at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) 
Caused by: java.lang.RuntimeException: java.io.IOException: Please correct the above warnings first. 
     at com.android.builder.tasks.Job.awaitRethrowExceptions(Job.java:79) 
     at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:209) 
     at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178) 
     at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174) 
     at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55) 
     at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47) 
     at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173) 
     at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) 
     at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244) 
     at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220) 
     at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231) 
     at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) 
     ... 60 more 
Caused by: java.io.IOException: Please correct the above warnings first. 
     at proguard.Initializer.execute(Initializer.java:473) 
     at proguard.ProGuard.initialize(ProGuard.java:233) 
     at proguard.ProGuard.execute(ProGuard.java:98) 
     at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:52) 
     at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:273) 
     at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:62) 
     at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:199) 
     at com.android.builder.tasks.Job.runTask(Job.java:51) 
     at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) 
     at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223) 


BUILD FAILED 

這Gdoc包含所有基於你所得到的警告,我得到了 https://docs.google.com/document/d/1YxbOfqaUyHJivYrs1hkHE4Tmmo4xAP8-aJkUJJB8e-k/edit?usp=sharing

感謝

+3

加上'minifyEnabled假 proguardFiles得到DefaultProguardFile('proguard-android.txt'),'proguard-rules.txt'# –

+0

http://stackoverflow.com/questions/33877134/errorexecution-failed-for-task-androidtransformclassesandresourceswithprogua –

+4

@IntelliJAmiya minifyEnabled false將禁用progaurd和我想啓用它 – Tony

回答

12

警告,我看到你有對圖書館的依賴依賴部分Java運行時(rt.jar),但不是Android運行時(android.jar)的一部分,因此您從ProGuard獲得警告。

如果您的應用程序仍與所有這些組件丟失工作,你可以配置ProGuard的不提醒你這一點,所以在您的ProGuard配置文件(例如:proguard-project.txt),您可以嘗試添加這些:

-dontwarn javax.servlet.** 
-dontwarn org.joda.time.** 
-dontwarn org.w3c.dom.** 

這應該可以幫助您解決任何額外的警告可能會留在你的構建:

的ProGuard手冊>故障排除>Warning: can't find referenced class

+2

謝謝我解決我的問題也加入這條線-dontwarn jcifs.http.NetworkExplorer – Tony

+0

很高興幫助@Tony – unbekant

相關問題