[英]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 interf
信息:Gradle任务[:app:assembleDebug]警告:butterknife.compiler.ButterKnifeProcessor $ IdScanner:找不到超类或接口com.sun.tools.javac.tree.TreeScanner警告:butterknife.compiler.ButterKnifeProcessor $ RClassScanner:可以找不到超类或接口com.sun.tools.javac.tree.TreeScanner警告:butterknife.compiler.ButterKnifeProcessor $ VarScanner:找不到超类或接口com.sun.tools.javac.tree.TreeScanner警告:org.apache。 poi.hssf.usermodel.DummyGraphics2d:找不到超类或接口java.awt.Graphics2D警告:org.apache.poi.hssf.usermodel.EscherGraphics:找不到超类或接口java.awt.Graphics警告:org。 apache.poi.hssf.usermodel.EscherGraphics2d:找不到超类或接口java.awt.Graphics2D警告:org.apache.poi.poifs.crypt.dsig.SignatureMarshalListener:找不到超类或接口org.w3c.dom .events.EventListener警告:org.apache.poi.xslf.usermodel.XSLFRenderingHint:找不到超类或接口 ace java.awt.RenderingHints$Key .... Error:Execution failed for task >':app:transformClassesAndResourcesWithProguardForDebug'.
ace java.awt.RenderingHints $ Key ....错误:任务>':app:transformClassesAndResourcesWithProguardForDebug'的执行失败。 Job failed, see logs for details
作业失败,请参阅日志以获取详细信息
My progard-rules is: 我的progard规则是:
# 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: 我的gradle:
buildTypes { release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
if i change minifyEnabled false. 如果我将minifyEnabled更改为false。 There are no errors.
没有错误。 I am using multidex mode.
我正在使用multidex模式。 How can I solve the problem?
我该如何解决这个问题?
Try this add this line in build.gradle app level dependencies 尝试此操作在build.gradle应用程序级别依赖项中添加此行
compile 'com.android.support:multidex:1.0.1' 编译'com.android.support:multidex:1.0.1'
dexOptions { javaMaxHeapSize "4g" } dexOptions {javaMaxHeapSize“ 4g”}
minifyEnabled false minifyEnabled false
multiDexEnabled true multiDexEnabled是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.