美文网首页
【The generated com.fubar.appidsu

【The generated com.fubar.appidsu

作者: FreedApe | 来源:发表于2019-07-23 13:26 被阅读0次

不同的buildType,使用applicationIdSuffix,生成不同的applicationId

1.在android studio 3.0以前,导入依赖使用的还是compile的时候:
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "XXX.XXX.XXX"
    }
    buildTypes {
        debug {
            ...
            applicationIdSuffix ".debug"
            // Version名につけるサフィックス
            versionNameSuffix '-dev'
            ...
        }
        staging {
            ...
            applicationIdSuffix ".debug"
            // Version名につけるサフィックス
            versionNameSuffix '-stg'
            ...
        }
        release {
            ...
        }
    }
...
// 重点
apt {
    arguments {
        resourcePackageName "XXX.XXX.XXX"
    }
}
...
}

2.在android studio 3.0以后,导入依赖使用implementation和api的时候:
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "XXX.XXX.XXX"
        // 重点
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ['resourcePackageName': android.defaultConfig.applicationId]
            }
        }
    }

    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            // Version名につけるサフィックス
            versionNameSuffix '-dev'
        }
        staging {
            applicationIdSuffix ".debug"
            // Version名につけるサフィックス
            versionNameSuffix '-stg'
        }
        release {
        ...
        }
    }
}

相关文章

网友评论

      本文标题:【The generated com.fubar.appidsu

      本文链接:https://www.haomeiwen.com/subject/umpolctx.html