After activating proguard for my android aplication in android studio, the app crashes with error says cannot find Mypackage.Application
class.
MyApplication classs extends MultiDexApplication
.
Here is the error I got and below is my proguard-rules.pro
file:
-libraryjars <java.home>/lib/rt.jar(javax/**)
-keepattributes *Annotation*,InnerClasses,EnclosingMethod,Signature
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn rx.**
-dontwarn retrofit.**
-dontwarn okio.**
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
-keepnames class com.fasterxml.jackson.** { *; }
-dontwarn com.fasterxml.jackson.databind.**
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-dontwarn com.marshalchen.ultimaterecyclerview.animators.BaseItemAnimator
-dontwarn com.google.appengine.api.urlfetch.**
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry.**
and here is MyAplication
class:
public class MyApplication extends MultiDexApplication {
private static Context mContext;
public static Context getContext() {
return mContext;
}
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
AnalyticsTrackers.initialize(mContext);
}
}
What is the solution?