您好,登錄后才能下訂單哦!
1.使用proguardgui混淆器對jar包進行混淆,出現EXCEPTION FROM SIMULATION錯誤:
[2014-07-08 14:29:55 - Test024_HouseBox_v02_jar] Dx EXCEPTION FROM SIMULATION: [2014-07-08 14:29:55 - Test024_HouseBox_v02_jar] Dx local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information. [2014-07-08 14:29:55 - Test024_HouseBox_v02_jar] Dx ...at bytecode offset 0000012f locals[0000]: Lcom/android/volley/toolbox/BasicNetwork; locals[0001]: Lcom/android/volley/Request; locals[0002]: J locals[0003]: <invalid> locals[0004]: Lorg/apache/http/HttpResponse; locals[0005]: [B locals[0006]: Ljava/util/Map; locals[0007]: Ljava/io/IOException; locals[0008]: <invalid> locals[0009]: <invalid> locals[000a]: <invalid> stack[0001]: N012bLcom/android/volley/NoConnectionError; stack[top0]: N012bLcom/android/volley/NoConnectionError; ...while working on block 012e ...while working on method performRequest:(Lcom/android/volley/Request;)Lcom/android/volley/NetworkResponse; ...while processing performRequest (Lcom/android/volley/Request;)Lcom/android/volley/NetworkResponse; ...while processing com/android/volley/toolbox/BasicNetwork.class [2014-07-08 14:29:55 - Test024_HouseBox_v02_jar] Dx 1 error; aborting [2014-07-08 14:29:55 - Test024_HouseBox_v02_jar] Conversion to Dalvik format failed with error 1
解決方法:在配置文件中去掉-keepattributes LocalVariable*Table這個配置項。
參考資料:Android項目:自構框架、SDK包或者jar文件庫的混淆及常見問題解決方法
2.引用庫正常,對庫的代碼打成jar包混淆后運行報錯Unable to execute dex: Multiple dex files define:
Unable to execute dex: Multiple dex files define Lcom/glblong/socshare/R$anim
解決方法:項目引用了不同版本的jar包導致的,如果libs中的jar包版本都是一致的,那么問題可能出現在使用proguradgui時引入的jar包版本不一致導致的。也就是在混淆過程中,引入的jar包要與項目中使用的jar文件一致。
參考資料:Android項目:自構框架、SDK包或者jar文件庫的混淆及常見問題解決方法
3.在你依賴的外部jar包已經混淆的情況下再進行混淆打包有可能出現以下情況:
Can't read [***\***.jar] (Can't process class [**/a/f.class] (Unknown verification type [108] in stack map frame))
[2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] Proguard returned with error code 1. See console [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] java.io.IOException: Can't read [F:\work_hb_v02_pbulish\Lib_SocShare_v237_0703\libs\untiy-classes.jar] (Can't process class [com/unity3d/player/UnityPlayer.class] (Unknown verification type [251] in stack map frame)) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.InputReader.readInput(InputReader.java:232) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.InputReader.readInput(InputReader.java:202) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.InputReader.readInput(InputReader.java:180) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.InputReader.execute(InputReader.java:78) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.ProGuard.readInput(ProGuard.java:196) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.ProGuard.execute(ProGuard.java:78) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.ProGuard.main(ProGuard.java:483) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] Caused by: java.io.IOException: Can't process class [com/unity3d/player/UnityPlayer.class] (Unknown verification type [251] in stack map frame) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.Cla***eader.read(Cla***eader.java:112) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.JarReader.read(JarReader.java:65) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.InputReader.readInput(InputReader.java:228) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] ... 6 more [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] Caused by: java.lang.RuntimeException: Unknown verification type [251] in stack map frame [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.createVerificationType(ProgramCla***eader.java:890) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.visitFullFrame(ProgramCla***eader.java:659) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.attribute.preverification.FullFrame.accept(FullFrame.java:114) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.visitStackMapTableAttribute(ProgramCla***eader.java:452) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.attribute.preverification.StackMapTableAttribute.accept(StackMapTableAttribute.java:71) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.visitCodeAttribute(ProgramCla***eader.java:422) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.visitProgramMethod(ProgramCla***eader.java:200) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.io.ProgramCla***eader.visitProgramClass(ProgramCla***eader.java:142) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] at proguard.io.Cla***eader.read(Cla***eader.java:91) [2014-07-17 10:51:15 - Test025_HouseBox_v02_test10] ... 12 more
解決方法:找到proguard源碼中proguard\src\proguard\classfile\ClassConstants.java類,然后修改ATTR_StackMapTable的值,將原來的的StackMapTable改為dummy.
public static final String ATTR_StackMapTable = "dummy";//"StackMapTable";
然后重新ant打包proguard,使用新的proguard來混淆就不會出現上面的問題。
ant打包proguard方法見:Android項目:通過ant重新打包proguard混淆器jar文件
參考資料:
1.Proguard returned with error code 1. (Proguard errors with untiy-classes.jar)
2.ProGuard Java Optimizer and Obfuscator
3.Android項目:通過ant重新打包proguard混淆器jar文件
其他參考資料:
1.Android項目:proguard混淆之常見問題及解決方法匯總
2.Android項目:proguard混淆之常見開源項目混淆配置
3.Android項目:自構框架、SDK包或者jar文件庫的混淆及常見問題解決方法
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。