目前我的应用程序有一个小问题,在大多数设备上一切正常,但在某些三星和 wiko 上我收到此错误:
java.lang.NoClassDefFoundError:android.support.v7.internal.view.menu.MenuBuilder
我在互联网上看到了一些答案,他们说在 proguard 文件中添加下面的行,在我的情况下这不起作用
-keep class !android.support.v7.internal.view.menu.**, ** { *; }
我的应用程序由 2 个模块组成(所以我有 2 个 proguard 文件),1 个模块用于主应用程序,另一个用于库
这是我的应用程序模块的 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.refresh.quickeer"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.+'
compile 'com.android.support:palette-v7:21.0.0'
compile 'com.xgc1986.android:parallaxpagertransformer:1.0.3'
compile project(':library')
}
Does somebody have a solution to this problem please ?
在遇到这个问题之前,我没有在我的应用程序上使用 proguard。我通过设置解决了这个问题minifyEnabled true
并使用以下 proguard 配置
-dontshrink
-keep class !android.support.v7.internal.view.menu.**,** {*;}
-keepattributes **
-dontwarn **
我测试了我的应用程序应用程序攻击 https://appthwack.com/在此修复之前和之后验证其是否有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)