我在混淆 Android 代码时遇到问题。我使用 Proguard 4.7 版和 Eclipse 作为我的 IDE。我把我改成proguard.cfg
这样:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * implements android.view.View.OnTouchListener
-keep class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keep class * extends android.preference.Preference {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
# LVL License binder class
-keep class com.android.vending.licensing.ILicensingService
# This is necessary for LVL among others. According to proguard doc java accesses enum fields by introspection.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#Optimization settings
-dontoptimize
当我编译我的项目时,我得到一个错误,我无法解决它。这是错误:
Unable to execute dex: Multiple dex files define Lchangebackground/app/OnSwipeListener
Conversion to Dalvik Format failed: Unable to execute dex: Multiple dex files define Lchangebackground/app/OnSwipeListener