更改.BuildConfig包

时间:2015-12-14 17:49:37

标签: android gradle build.gradle android-build

有没有办法动态更改生成的文件包.BuildConfig?

我想使用build.gradle文件来使用applicationId并在不同版本之间更改包名称。

由于

3 个答案:

答案 0 :(得分:1)

The applicationId field just changes the packagename in the manifest. All classes will be still in the original package.

答案 1 :(得分:1)

我还在AndroidManifest.cml中声明了ApplicationId或Package

  

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxx">

替换xxx解决了我的问题。

答案 2 :(得分:0)

更改以下代码:Build.gradle(模块):

defaultConfig {
    applicationId "com.xxxxx.yyyy" <-----!!!
    minSdkVersion ?
    targetSdkVersion ?
    versionCode ?
    versionName ?
    multiDexEnabled true
}

同步后,BuildConfig中的APPLICATION_ID已更新。

如果在模拟器中安装有问题。转到AVD Manager,并立即停止和启动。

相关问题