我已经安装了Android应用程序wihch使用支持lib。它与Proguard混淆了,它在Home Activity上代码:
` @Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home, menu); //ith crashes here
return true;
} `
投掷:
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)
我使用以下方式启用了proGuard:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
在project.properties
中我的配置文件如下所示:
-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);
}
我添加了很多东西,因为我正在为这个问题寻找解决方案。
答案 0 :(得分:7)
我不确定是怎么回事。但是将以下行添加到proguard规则可以解决问题。
-keep class org.xmlpull.v1。** {*; }