当我启动应用程序时,我会收到很多警告和错误:
信息: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:找不到 超类或接口java.awt.RenderingHints $ Key .... 错误:任务>':app:transformClassesAndResourcesWithProguardForDebug'的执行失败。 作业失败,请参阅日志了解详情
我的计划规则是:
# 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>; }
我的傻瓜:
buildTypes { release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
如果我改变minifyEnabled false。没有错误。我正在使用multidex模式。我该如何解决这个问题?
答案 0 :(得分:0)
试试这个 在build.gradle应用程序级别依赖项中添加此行
编译'com.android.support:multidex:1.0.1'
dexOptions { javaMaxHeapSize“4g” } 强>
minifyEnabled false
multiDexEnabled true