I have an app and want to duplicate it (new namespace), so this App can be installed 2x on the same device. (In the future the 2 apps should be developed separately, only to understand) What is the best way to do this with Android Studio? Are there any features in Android Studio?
我有一个应用程序,想要复制它(新的命名空间),所以这个应用程序可以在同一个设备上安装2x。(未来这两个应用应该单独开发,只为了了解)Android Studio的最佳方式是什么?Android Studio有什么功能吗?
3 个解决方案
#1
1
You just have to change your packagename. Lets say you first have the name com.app.first
then your other application can have com.app.second
?
你只要换一下包装就可以了。假设你首先有一个名字com.app。首先,你的其他应用程序可以有com.app。第二个吗?
Make sure to change the packagename in your manifest aswell.
请务必在您的舱单中也更改包装名称。
#2
0
This has nothing to do with Android Studio but with the build automation tool you are using, which is gradle i assume. You dont need to change the namespace, just the appId. You can achieve this by using Product Flavors.
这与Android Studio没有任何关系,但与您正在使用的构建自动化工具有关,我认为这是gradle。您不需要更改名称空间,只需更改appId。您可以通过使用产品风味来实现这一点。
Check this chapter from the android documentation Configure Product Flavors
从android文档中查看这一章配置产品的味道。
#3
0
You can do this in app build.gradle inside productFlavors block:
你可以在应用程序构建中这样做。gradle内部productFlavors块:
productFlavors {
projecta{
applicationId "com.blahblah.projecta"
}
projectb{
applicationId "com.blahblah.projectb"
}
}
Then you can choose the desired option before compiling in Build Variants panel.
然后,您可以在编译Build variant面板之前选择所需的选项。
Check this guide for more details.
更多细节请参阅本指南。
#1
1
You just have to change your packagename. Lets say you first have the name com.app.first
then your other application can have com.app.second
?
你只要换一下包装就可以了。假设你首先有一个名字com.app。首先,你的其他应用程序可以有com.app。第二个吗?
Make sure to change the packagename in your manifest aswell.
请务必在您的舱单中也更改包装名称。
#2
0
This has nothing to do with Android Studio but with the build automation tool you are using, which is gradle i assume. You dont need to change the namespace, just the appId. You can achieve this by using Product Flavors.
这与Android Studio没有任何关系,但与您正在使用的构建自动化工具有关,我认为这是gradle。您不需要更改名称空间,只需更改appId。您可以通过使用产品风味来实现这一点。
Check this chapter from the android documentation Configure Product Flavors
从android文档中查看这一章配置产品的味道。
#3
0
You can do this in app build.gradle inside productFlavors block:
你可以在应用程序构建中这样做。gradle内部productFlavors块:
productFlavors {
projecta{
applicationId "com.blahblah.projecta"
}
projectb{
applicationId "com.blahblah.projectb"
}
}
Then you can choose the desired option before compiling in Build Variants panel.
然后,您可以在编译Build variant面板之前选择所需的选项。
Check this guide for more details.
更多细节请参阅本指南。