我正在尝试使用proguard减小apk的大小。我这样做的时候收到这些warnigs消息,
Warning: can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-lang-2.6.jar:META-INF/LICENSE.txt])
Warning: can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry [commons-lang-2.6.jar:META-INF/NOTICE.txt])
Warning: can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme])
除了保持课程有没有办法排除这些文件?我已将它们排除在gradle文件中,但这似乎不起作用。
答案 0 :(得分:1)
如果您使用的是Android Studio,请添加此
到你的build.gradle
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.README'
}
///完成示例
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName '1.0'
renderscriptTargetApi 22
}
buildTypes {
debug {
debuggable true
minifyEnabled false
renderscriptDebuggable true
versionNameSuffix "-debug"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
debuggable false
minifyEnabled true
shrinkResources false
renderscriptDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.README'
}
}