构建工具21.1.1 proguard不识别`-keep`和规则

时间:2014-11-26 20:21:51

标签: android android-studio proguard android-gradle build-tools

Warning:library class org.apache.http.conn.ManagedClientConnection extends or implements program class org.apache.http.HttpClientConnection

尽管我的proguard规则文件中有-dontwarn org.apache.**

Warning:org.joda.time.Weeks: can't find referenced class org.joda.convert.FromString

尽管我的proguard规则文件中有-dontwarn org.joda.**-keep class org.** { *; }还有-keep interface org.** { *; }

Warning:there were 140 instances of library classes depending on program classes.

Error:Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.

然后我看看我的app结构

 buildTypes {
    release {

        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-project.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
        zipAlignEnabled true
    }
   }

proguard-project.txt与此模块中的此build.gradle文件位于同一文件夹中。

现在还不确定是什么坏了,我想当我需要更新到Build Tools 21.1.1以使其他工作正常时,还有其他人没有告诉我。任何有识之士。

1 个答案:

答案 0 :(得分:0)

我的解决方案是将我的所有规则复制到IDE先前为我自动生成的proguard-rules.pro中,然后proguard按预期工作

我仍然不知道应该找到getDefaultProguardFile('proguard-project.txt')的位置,但是它没有被读取,我在我的模块和项目的根文件夹中移动了它。