问题描述
我挣扎是 java.lang.NoClassDefFoundError的调用时的 com.mixpanel.android.mpmetrics.MixpanelAPI
这是因为我跑的的ProGuard 的(我要)。但是我加的的ProGuard 的排斥:
It is because I run proguard (I have to). However I added proguard exclusion:
-keep public class com.mixpanel.android.mpmetrics.**
或
-keep public class com.mixpanel.android.mpmetrics.MixpanelAPI { *; }
但它并不能帮助。
but it doesn't help.
的通知值得一提的是,我得到的 MixpanelAPI LIB 的那样:
Notice worth mentioning is that I get MixpanelAPI lib in that way:
compile "com.mixpanel.android:mixpanel-android:4.0.0@aar"
因此,它是 AAR ,不是标准的罐
如何使用ProGuard运行它,但不能失去的 Mixpanel 的code?
How to run it with proguard but not loosing Mixpanel code ?
推荐答案
由于4.5版本,Mixpanel建议使用以下的ProGuard设置
As of version 4.5, Mixpanel advises using the following proguard settings
-keep class com.mixpanel.android.abtesting.** { *; }
-keep class com.mixpanel.android.mpmetrics.** { *; }
-keep class com.mixpanel.android.surveys.** { *; }
-keep class com.mixpanel.android.util.** { *; }
-keep class com.mixpanel.android.java_websocket.** { *; }
-keepattributes InnerClasses
-keep class **.R
-keep class **.R$* {
<fields>;
}
您可以找到Mixpanel库的README这些指令在 https://github.com/mixpanel/mixpanel-android/blob/master/README.md 在changelog的4.5版本
You can find these instructions in the README of the Mixpanel library, at https://github.com/mixpanel/mixpanel-android/blob/master/README.md in the changelog for version 4.5
这篇关于MixPanelAPI的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!