enginebai / AndroidBase

Android project template for Gradle Kotlin DSL + 100% Kotlin + Base module + Extensions = ❤️
https://enginebai.com/2019/10/21/gradle-kotlin-dsl/
MIT License
132 stars 17 forks source link

NPE while building with Proguard #19

Open enginebai opened 3 years ago

enginebai commented 3 years ago

While building app with Proguard, it raises the NPE.

2020-12-02T14:04:34.397+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.NullPointerException
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:537)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.UsageMarker.markConstant(UsageMarker.java:1246)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.UsageMarker.visitRequiresInfo(UsageMarker.java:1040)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.attribute.module.ModuleAttribute.requiresAccept(ModuleAttribute.java:138)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.UsageMarker.visitModuleAttribute(UsageMarker.java:739)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.attribute.module.ModuleAttribute.accept(ModuleAttribute.java:99)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java:619)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.UsageMarker.markProgramClassBody(UsageMarker.java:124)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.UsageMarker.visitProgramClass(UsageMarker.java:94)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.visitor.ClassNameFilter.visitProgramClass(ClassNameFilter.java:128)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.ProgramClass.accept(ProgramClass.java:430)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.visitor.AllClassVisitor.visitClassPool(AllClassVisitor.java:45)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.visitor.MultiClassPoolVisitor.visitClassPool(MultiClassPoolVisitor.java:85)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.classfile.ClassPool.accept(ClassPool.java:110)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.shrink.Shrinker.execute(Shrinker.java:90)
2020-12-02T14:04:34.398+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.ProGuard.shrink(ProGuard.java:381)
2020-12-02T14:04:34.399+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at proguard.ProGuard.execute(ProGuard.java:145)
2020-12-02T14:04:34.399+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at com.android.build.gradle.internal.tasks.ProguardDelegate.run(ProguardDelegate.kt:118)
2020-12-02T14:04:34.399+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 194 more
2020-12-02T14:04:34.399+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2020-12-02T14:04:34.399+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
BUILD FAILED in 1m 54s
enginebai commented 3 years ago

UPDATED

It seems to be Proguard bug, the workaround is add classpath 'net.sf.proguard:proguard-gradle:6.2.2' to root build.gradle.kts dependencies.