【发布时间】:2019-07-05 12:02:04
【问题描述】:
我正在尝试获取一组 proguard 规则来使用 proguard 编译我的应用程序,但我无法解决 Facebook-Conceal 的问题
java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.Countable"
我尝试使用 Github 中 Facebook-Conceal 存储库中指定的 proguard 规则以及来自论坛的建议。似乎没有任何效果。而且我的自定义规则也不起作用
# Facebook Conceal
# from main project
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.crypto.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.crypto.proguard.annotations.KeepGettersAndSetters
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.crypto.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.crypto.proguard.annotations.DoNotStrip *;
}
-keepclassmembers @com.facebook.crypto.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
# from first-party/fbjni/java/com/facebook/jni/fbjni.pro
# For common use cases for the hybrid pattern, keep symbols which may
# be referenced only from C++.
-keepclassmembers class * {
com.facebook.jni.HybridData *;
<init>(com.facebook.jni.HybridData);
}
-keepclasseswithmembers class * {
com.facebook.jni.HybridData *;
}
# from first-party/proguard/annotations/proguard_annotations.pro
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class com.facebook.crypto.** { *; }
-keep class com.facebook.jni.** { *; }
-keepclassmembers class com.facebook.jni.** {*;}
-keepclassmembers class com.facebook.cipher.jni.** { *; }
-keepclasseswithmembers class * {
native <methods>;
}
#just add this, everything is fine..
-dontwarn com.facebook.**
java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.Countable"
【问题讨论】:
标签: android kotlin proguard facebook-conceal