简体   繁体   English

Android proguard minifyEnabled true + multidex =错误

[英]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.

相关问题 proguard android studio 中的错误,无法使用 minifyenabled true 构建我的项目 - Error in proguard android studio, cant build my project with minifyenabled true Android Proguard:minifyEnabled为true会自动将混淆设置为true吗? - Android Proguard : Is minifyEnabled true automatically setting obfuscation to true? Android Proguard使用Multidex - Android proguard using Multidex Android multidex不支持proguard - Android multidex not supporting with proguard Android minifyEnabled true for firebase - Android minifyEnabled true for firebase 使用 minifyEnabled 进行 Android 调试 true - Android debugging with minifyEnabled true Proguard minifyEnabled True 应用程序未按预期工作 - Proguard minifyEnabled True app not working as expected Android ProGuard + MultiDex导致ClassNotFoundException - Android ProGuard +MultiDex causes ClassNotFoundException 使用minifyEnabled true来避免multidex会禁用断点-如何解决? - Using minifyEnabled true to avoid multidex disables breakpoints - How to fix? 添加“minifyEnabled true”和“proguard-android-optimize.txt”是否会混淆sqlite数据库并使其与以前的版本不兼容? - Does adding "minifyEnabled true" and 'proguard-android-optimize.txt' obfuscate the sqlite database and make it incompatible with previous versions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM