将字节码转换为dex时出错:启用Proguard

时间:2017-02-06 07:28:43

标签: android android-studio gradle proguard

我在我的项目中使用作为.AAR导入的库模块,一切正常,直到启用proguard。启用Proguard后,库在构建项目时会出现以下异常。

我尝试了清洁,构建,重建项目等所有内容。 还尝试将gradle版本从2.3.0修改为3.3.0,但都是徒劳的。

我必须保持混淆(我现在无法做到)。

尝试将所有这些添加到我的proguard.txt文件中:

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
#-dontobfuscate
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
#-dontoptimize
-dontpreverify

例外:

  

{" kind":"错误","文字":"将字节码转换为dex时出错:\ n原因:   java.lang.RuntimeException:异常解析   课程","来源":[{}],"原创":"意想不到的顶层   EXCEPTION:\ njava.lang.RuntimeException:异常解析   类的\ n \达   com.android.dx.command.dexer.Main.processClass(Main.java:752)\ n \达   com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)\ n \达   com.android.dx.command.dexer.Main.access $ 1200(Main.java:85)\ n \达   com.android.dx.command.dexer.Main $ FileBytesConsumer.processFileBytes(Main.java:1645)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)\ n \达   com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)\ n \达   com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)\ n \达   com.android.dx.command.dexer.Main.processOne(Main.java:672)\ n \达   com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)\ n \达   com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)\ n \达   com.android.dx.command.dexer.Main.run(Main.java:275)\ n \达   com.android.dx.command.dexer.Main.main(Main.java:245)\ n \达   com.android.dx.command.Main.main(Main.java:106)\ n由以下人员提供:   com.android.dx.cf.iface.ParseException:类名   ( hk / com / domainname / libname / r )与路径不匹配   (的 HK / COM /域名/ LIBNAME / R.class )\ n \达   com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)\ n \达   com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)\ n \达   com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)\ n \达   com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)\ n \达   com.android.dx.command.dexer.Main.parseClass(Main.java:764)\ n \达   com.android.dx.command.dexer.Main.access $ 1500(Main.java:85)\ n \达   com.android.dx.command.dexer.Main $ ClassParserTask.call(Main.java:1684)\ n \达   com.android.dx.command.dexer.Main.processClass(Main.java:749)\ n \ t ...   还有21个\ n","工具":" Dex"}

0 个答案:

没有答案