I've got android app wihch uses support lib. It was obfuscated with Proguard, and itcrashes on Home Activity on code:
` @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home, menu); //ith crashes here
return true;
} `
throwing:
java.lang.NoSuchMethodError: android.util.Xml.asAttributeSet at android.support.v7.internal.view.SupportMenuInflater.inflate(Unknown Source) at com.sample.mobile.HomeActivity.onCreateOptionsMenu(Unknown Source)
I've enabled proGuard using :
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
in project.properties
My config file looks like this:
-libraryjars libs
-libraryjars C:\adt-bundle-windows-x86_64-20131030\sdk\platforms\android-19\android.jar
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v7.app.** { *; }
-keep interface android.support.v7.app.** { *; }
-keep class android.support.v7.internal.** { *; }
-keep interface android.support.v7.internal.** { *; }
-keep class android.util.Xml..** { *; }
-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.preference.Preference
-keep public class com.android.vending.billing.IInAppBillingService
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-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.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}
I added many thing, cos I was looking for solution for this problem.
I am not sure how it is happened. But adding following line to proguard rules solve the problem.
-keep class org.xmlpull.v1.** { *; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With