如何用摇篮组装时更改Android应用程序包的名称? [英] How to change the Android app package name when assembling with Gradle?
本文介绍了如何用摇篮组装时更改Android应用程序包的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能改变使用摇篮Android应用程序的包名?
Is it possible to change the package name of an Android application using Gradle?
我需要编译同一应用程序的两个副本,具有独特的包名(这样我就可以发布到市场的两倍)。
I need to compile two copies of the same app, having a unique package name (so I can publish to the market twice).
推荐答案
您可以让这样的事情
android {
...
defaultConfig {
minSdkVersion 8
versionCode 10
}
flavorDimensions "flavor1", "flavor2"
productFlavors {
flavor1 {
applicationId "com.example.flavor1"
versionCode 20
}
flavor2 {
applicationId "com.example.flavor2"
minSdkVersion 14
}
}
}
您也可以改变字段 android.defaultConfig.applicationId
如果你想要做一次性的构建。
You can also change the field android.defaultConfig.applicationId
if you want to do one-off builds.
来自:<一href="http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-Flavor-Configuration">http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-Flavor-Configuration
这篇关于如何用摇篮组装时更改Android应用程序包的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文