2 sinat 29351891 sinat_29351891 于 2015.06.30 17:10 提问

,有木有大神Android 工程引用jar后代码混淆错误

-injars bin\adpush_jar.jar
-outjars adpush_0330package_pro.jar

-libraryjars 'D:\资料\adt-bundle-windows-x86-20130219\sdk\platforms\android-17\android.jar'

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-optimizationpasses 5
-dontpreverify
-verbose

-keep public class * extends android.app.Activity

-keep public class * extends android.app.Application

-keep public class * extends android.app.Service

-keep public class * extends android.content.BroadcastReceiver

-keep public class * extends android.content.ContentProvider

-keep public class * extends android.app.backup.BackupAgentHelper

-keep public class * extends android.preference.Preference

-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembers class * {
public (android.content.Context,android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public (android.content.Context,android.util.AttributeSet,int);
}

-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}

-keep class * extends android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

-keep public class com.ad.view.AdMain {
public static com.ad.view.AdMain getInstance(android.content.Context);
}

Also keep - Enumerations. Keep the special static methods that are required in

enumeration classes.

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

Keep names - Native method names. Keep all native class/method names.

-keepclasseswithmembers,allowshrinking class * {
native ;
}
以上是jar包里的cfg里的代码

代码混淆后出现 如下错误:

Proguard returned with error code 1. See console
[2015-06-30 17:12:30 - test6] java.io.IOException: Can't read D:\workspace\test6\libs\adpush.jar)
[2015-06-30 17:12:30 - test6] at proguard.InputReader.readInput(InputReader.java:230)
[2015-06-30 17:12:30 - test6] at proguard.InputReader.readInput(InputReader.java:200)
[2015-06-30 17:12:30 - test6] at proguard.InputReader.readInput(InputReader.java:178)
[2015-06-30 17:12:30 - test6] at proguard.InputReader.execute(InputReader.java:78)
[2015-06-30 17:12:30 - test6] at proguard.ProGuard.readInput(ProGuard.java:196)
[2015-06-30 17:12:30 - test6] at proguard.ProGuard.execute(ProGuard.java:78)
[2015-06-30 17:12:30 - test6] at proguard.ProGuard.main(ProGuard.java:492)
[2015-06-30 17:12:30 - test6] Caused by: java.io.IOException: Can't process class com/ad/control/y.class
[2015-06-30 17:12:30 - test6] at proguard.io.ClassReader.read(ClassReader.java:112)
[2015-06-30 17:12:30 - test6] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2015-06-30 17:12:30 - test6] at proguard.io.JarReader.read(JarReader.java:65)
[2015-06-30 17:12:30 - test6] at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2015-06-30 17:12:30 - test6] at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2015-06-30 17:12:30 - test6] at proguard.InputReader.readInput(InputReader.java:226)
[2015-06-30 17:12:30 - test6] ... 6 more
[2015-06-30 17:12:30 - test6] Caused by: java.lang.RuntimeException
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.RuntimeDataInput.readUnsignedShort(RuntimeDataInput.java:196)
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.ProgramClassReader.visitFullFrame(ProgramClassReader.java:655)
[2015-06-30 17:12:30 - test6] at proguard.classfile.attribute.preverification.FullFrame.accept(FullFrame.java:114)
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.ProgramClassReader.visitStackMapTableAttribute(ProgramClassReader.java:452)
[2015-06-30 17:12:30 - test6] at proguard.classfile.attribute.preverification.StackMapTableAttribute.accept(StackMapTableAttribute.java:71)
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.ProgramClassReader.visitCodeAttribute(ProgramClassReader.java:422)
[2015-06-30 17:12:30 - test6] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.ProgramClassReader.visitProgramMethod(ProgramClassReader.java:200)
[2015-06-30 17:12:30 - test6] at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:142)
[2015-06-30 17:12:30 - test6] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2015-06-30 17:12:30 - test6] at proguard.io.ClassReader.read(ClassReader.java:91)
[2015-06-30 17:12:30 - test6] ... 11 more

2个回答

baidu_30855055
baidu_30855055   2015.09.29 09:34
已采纳

把-optimizationpasses 5 改成-optimizationpasses 1或2 ,超过2次,会报错

bhdgx
bhdgx   2015.06.30 23:25

请注意异常信息: Can't read D:\workspace\test6\libs\adpush.jar),你在什么地方引用了这个jar包,而在对应的目录下有没有这个文件

Csdn user default icon
上传中...
上传图片
插入图片