Tips [Android] to the resource file module automatically prefixed by gradle

Problem: the problem often encountered different module, the resources of the same name, in order to solve this problem, you can add different prefixes to the resources of each module, gradle script configuration is as follows:

android {
    compileSdkVersion rootProject.ext.android.compileSdkVersion
    buildToolsVersion rootProject.ext.android.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.android.minSdkVersion
        targetSdkVersion rootProject.ext.android.targetSdkVersion
        versionCode 1
        versionName "1.0"

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    resourcePrefix "user_"   //前缀的名字
}

Guess you like

Origin www.cnblogs.com/gregpeng/p/11354662.html