Delphian
Delphian

Reputation: 1760

Android proguard minifyEnabled true + multidex = error

When I start my app I have a lot of warnings and errors:

Information:Gradle tasks [:app:assembleDebug] Warning:butterknife.compiler.ButterKnifeProcessor$IdScanner: can't find superclass or interface com.sun.tools.javac.tree.TreeScanner Warning:butterknife.compiler.ButterKnifeProcessor$RClassScanner: can't find superclass or interface com.sun.tools.javac.tree.TreeScanner Warning:butterknife.compiler.ButterKnifeProcessor$VarScanner: can't find superclass or interface com.sun.tools.javac.tree.TreeScanner Warning:org.apache.poi.hssf.usermodel.DummyGraphics2d: can't find superclass or interface java.awt.Graphics2D Warning:org.apache.poi.hssf.usermodel.EscherGraphics: can't find superclass or interface java.awt.Graphics Warning:org.apache.poi.hssf.usermodel.EscherGraphics2d: can't find superclass or interface java.awt.Graphics2D Warning:org.apache.poi.poifs.crypt.dsig.SignatureMarshalListener: can't find superclass or interface org.w3c.dom.events.EventListener Warning:org.apache.poi.xslf.usermodel.XSLFRenderingHint: can't find superclass or interface java.awt.RenderingHints$Key .... Error:Execution failed for task >':app:transformClassesAndResourcesWithProguardForDebug'. Job failed, see logs for details

My progard-rules is:

# Workaround for ProGuard not recognizing dontobfuscate
-dontobfuscate
-dontoptimize
-optimizations !code/allocation/variable
#Rules for javascript and webview
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
   public *;
}
-keepattributes *Annotation*,EnclosingMethod,Signature
#Parcel
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}
-keep class org.parceler.Parceler$$Parcels
-keep public class org.apache.poi.** {*;}
#BUTTERKNIFE
# Retain generated class which implement ViewBinder.
-keep public class * implements butterknife.internal.ViewBinder   

{ public(); }

# Prevent obfuscation of types which use ButterKnife annotations since the simple name
# is used to reflectively look up the generated ViewBinder.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* <methods>; }
-keepclasseswithmembernames class * { @butterknife.* <fields>; }

My gradle:

buildTypes { release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        } }

if i change minifyEnabled false. There are no errors. I am using multidex mode. How can I solve the problem?

Upvotes: 0

Views: 753

Answers (1)

Ashish
Ashish

Reputation: 11

Try this add this line in build.gradle app level dependencies

compile 'com.android.support:multidex:1.0.1'

dexOptions { javaMaxHeapSize "4g" }

minifyEnabled false

multiDexEnabled true

Upvotes: 0

Related Questions