我尝试了Google中存在的所有选项,但没有任何帮助。 在Gradle 1.3项目的版本上,但是当所有的组件在组装2,2,3发布版本错误时。
启用proguard时出错:
Error:java.lang.NullPointerException
Warning:The interface com/github/tibolte/agendacalendarview/agenda/IAgendaHeaderView has a static method "inflate" but backporting default methods is not enabled
Warning:Exception while processing task java.io.IOException: java.lang.NullPointerException
Error:java.lang.RuntimeException: Job failed, see logs for details
Error:java.io.IOException: java.lang.NullPointerException
摇篮:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
signingConfigs {
releaseConfig {
storeFile file("test.jks")
storePassword "test"
keyAlias "test"
keyPassword "test"
}
}
defaultConfig {
applicationId "by.test.by"
minSdkVersion 15
targetSdkVersion 25
// versionCode 1
versionName project.props.version
multiDexEnabled true
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
// incremental false
javaMaxHeapSize "2048m"
preDexLibraries = false
Proguard规则:
-dontwarn by.mrsoft.mrdoc.**
-dontwarn com.radaee.**
-dontwarn okio.**
-dontwarn org.joda.time.**
-adaptresourcefilenames
-adaptresourcefilecontents
-keepdirectories
-keep class android.support.v7.** { *; }
-keep class android.support.graphics.drawable.** { *; }
-assumenosideeffects class * {
@by.mrsoft.mrdoc.model.System.OnlyDebug *;
}
-keep class org.kxml2.** { *; }
-keep class org.acra.** { *; }
# исключение Radaee
-keep class com.radaee.** { *; }
#-keep class by.mrsoft.mrdoc.** { *; }
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
-keep class com.feitian.** { *; }
-keep class org.pkcs11.** { *; }
-keep class ru.aladdin.** { *; }
-keep class by.mrsoft.mrdoc.Eds.** { *; }
#-keep class java.awt.** { *; }
#-keep class javax.naming.** { *; }
#-keep class org.spongycastle.** { *; }
#-libraryjars <java.home>/lib/rt.jar
-dontwarn java.awt.**
-dontwarn javax.naming.**
-keep class com.sun.** { *; }
-keep class ru.rutoken.** { *; }
-keep class ru.CryptoPro.** { *; }
-keep class javax.** { *; }
-keep class com.intellij.** { *; }
-keep class org.apache.** { *; }
-dontwarn ru.CryptoPro.**
-optimizationpasses 1
#-optimizations !code/allocation/variable,
-dontwarn org.apache.**
-keep class org.apache.** { *; }
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class android.support.design.widget.** { *; }
-keep interface android.support.design.widget.** { *; }
-dontwarn android.support.design.**
gradle出错:
失败:构建因异常而失败。
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
* Try:
Run with --debug option to get more log output.
* 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:66)
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.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.RuntimeException: Job failed, see logs for details
at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:196)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:178)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:174)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)
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:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
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: java.io.IOException: java.lang.NullPointerException
at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:283)
at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
at com.android.builder.tasks.Job.runTask(Job.java:49)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223)
Caused by: java.lang.NullPointerException
at proguard.util.FixedStringMatcher.matches(FixedStringMatcher.java:52)
at proguard.util.OrMatcher.matches(OrMatcher.java:46)
at proguard.classfile.util.WarningPrinter.accepts(WarningPrinter.java:89)
at proguard.classfile.util.WarningPrinter.print(WarningPrinter.java:77)
at proguard.AssumeNoSideEffectsChecker.checkClassSpecifications(AssumeNoSideEffectsChecker.java:86)
at proguard.ConfigurationChecker.check(ConfigurationChecker.java:141)
at proguard.ProGuard.execute(ProGuard.java:73)
at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:54)
at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:254)
... 5 more
答案 0 :(得分:0)
如果启用,请尝试禁用“即时运行”并重建项目。另外,看看是否按照此处给出的说明设置了所有内容: