Proguard - also use proguard files from modules

妖精的绣舞 提交于 2019-12-05 05:32:58
prom85

The solution is to add following line to the libraries build.gradle: consumerProguardFiles 'proguard-rules.pro'

So my androKnife library looks like following:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            consumerProguardFiles 'proguard-rules.pro'
        }
    }
}

dependencies {

    ...
}
Jenus Dong

So, main module proguard code, likes this:

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
                                                 'main_proguard-rules.pro'
        }
    }

Who does know the principle of the inner relationship of proguardFiles? Auto merged or Overrided when has the same proguard code?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!