我在google,stackoverflow等上对此进行了大量搜索,但还没有得到完美的解决方案。实际上我想阻止我的应用程序进行逆向工程,为了达到这个目的,我使用了proguard并为我的项目定义了一些规则。定义上面的规则后,我签名的apk不会超出Splash Screen。如果除了Proguard之外还有其他一些解决方案,那么也欢迎。
proguard-rules.pro
-keep public class com.bbpos.emvswipe.* {
public *** get*();
public void set*(***);
}
-keep public class com.bbpos.wisepad.* {
public *** get*();
public void set*(***);
}
-dontwarn com.bbpos.**
-keep class com.github.mikephil.charting.** { *; }
-dontwarn io.realm.**
-keep public class * extends org.xmlpull.v1.XmlPullParser
-dontwarn org.xmlpull.**
-keep public class com.google.android.gms.cast.
framework.media.TracksChooserDialogFragment
-dontwarn com.google.android.gms.cast.framework.**
-keep class com.google.android.gms.internal.** { *; }
-dontwarn com.google.android.gms.internal.zznv
-keep class org.codehaus.jackson.map.ObjectMapper
-dontwarn org.codehaus.jackson.**
-keep class okhttp3.internal.huc.HttpURLConnectionImpl
-dontwarn okhttp3.**
-keep class java.nio.file.*
-dontwarn java.nio.file.*
-keep class org.codehaus.mojo.animal_sniffer.*
-dontwarn org.codehaus.mojo.animal_sniffer.*
-keep public class org.simpleframework.**{ *; }
-keep class org.simpleframework.xml.**{ *; }
-keep class org.simpleframework.xml.core.**{ *; }
-keep class org.simpleframework.xml.util.**{ *; }
-dontwarn org.simpleframework.xml.stream.**
logcat
W/dalvikvm: Failed processing annotation value
W/System.err: java.lang.NoSuchFieldError: APP_PREFERENCE
W/System.err: at java.lang.reflect.Field.getAnnotation(Native Method)
W/System.err: at java.lang.reflect.Field.getAnnotation(Field.java:209)
W/System.err: at cbm.a(Unknown Source)
W/System.err: at cbk.i(Unknown Source)
W/System.err: at com.sparken.echallan.activity.SplashActivity.onCreate(Unknown Source)
W/System.err: at android.app.Activity.performCreate(Activity.java:5264)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
W/System.err: java.lang.NullPointerException
W/System.err: at com.sparken.echallan.activity.SplashActivity.onCreate(Unknown Source)
W/System.err: at android.app.Activity.performCreate(Activity.java:5264)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
答案 0 :(得分:-1)
尝试从progaurd-rules文件中删除所有公开单词。