问题描述
我已经使用ProGuard strugling使Spongycastle工作。
大多数时候,当我导出签署APK,无论我有错误,或者应用程序将启动前刚刚崩溃的问题来了。
I've been strugling with proguard to make Spongycastle work.Most of the time, the problem comes when I'm exporting a signed APK, either I've got error, or the app will just crash before starting.
所以,我已经成功地收集信息,以得到一个工作ProGuard的配置:
So, I've managed to gather informations to get a working proguard configuration :
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-repackageclasses ''
-allowaccessmodification
-keepattributes *Annotation*
-optimizations !code/simplification/arithmetic
-libraryjars C:\Program Files\Java\jre7\lib\rt.jar
-libraryjars libs\sc-light-jdk15on-1.47.0.2.jar
-libraryjars libs\scprov-jdk15on-1.47.0.2.jar
-injars libs
-outjars bin/classes-processed.jar
-dontwarn javax.naming.**
-dontwarn android.support.**
####
-keep class org.** { *; }
-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
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
我跑的 ADT版本:22.0.0.v201305140200--675183
测试手机的的Android 2.3.5下
这是我借用的是部分 -keep类组织**。{*;}
....我这样做对吗?我已经试过 -keep类org.spongycastle **。{*;}
,但应用启动前刚刚崩溃...
The part that borrows me is the "-keep class org.** { *; }
" .... Am I doing it right ? I've tried "-keep class org.spongycastle.** { *; }
", but the app just crash before startup...
谢谢!
推荐答案
我们加入
-keep class org.spongycastle.**
-dontwarn org.spongycastle.jce.provider.X509LDAPCertStoreSpi
-dontwarn org.spongycastle.x509.util.LDAPStoreHelper
但是我们现在碰上,我们打的2 ^ 16的DEX方法限制与lib中的问题。
我们只需要它的MD5和SHA-1算法,有些手机不发货的。
But we now run into the problem that we hit the DEX method limit of 2^16 with that lib.We only need it for the MD5 and SHA-1 algorithms as some phones don't ship those.
这篇关于使用Spongycastle使用ProGuard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!