Android 使用proguard规则排除文件

Android 使用proguard规则排除文件,android,android-studio,gradle,proguard,Android,Android Studio,Gradle,Proguard,我正在尝试使用proguard减小apk的大小。我在这么做的时候收到了这些警告信息 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.

我正在尝试使用proguard减小apk的大小。我在这么做的时候收到了这些警告信息

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文件中排除了这些功能,但这似乎不起作用。

如果您使用的是Android Studio,请添加此功能

为了你的身材,格雷德尔

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'
    }

}

你使用android studio还是eclipse?