什么是同时安装稳定和开发的应用程序版本的实用方法? [英] What is a practical way to install stable and development app versions simultaneously?
问题描述
我想保持我的手机上我的应用程序的稳定版本,并继续发展......这将使应用程序在手机上两次,如果有这样做的实用方法。
I want to keep a stable version of my app on my phone, and continue developing... which would put the app on the phone twice, if there's a practical way to do that.
一个搜索导致家伙做什么,我已经考虑过:重新分解包名,也许用不同的图标文件。这是一种不方便,而且容易做错事,或遗忘等。
A search led to guys doing what I already had considered: re-factoring the package name, and maybe using a different icon file. That's kind of unhandy, and prone to doing something wrong, or forgetting, etc.
使用Android的工作室,是有什么花哨的人可以在的build.gradle文件中呢,还是其他的配置文件之一,使这项工作容易吗?
Using Android Studio, is there something fancy a person could do within the build.gradle files, or one of the other config files, to make this work easily?
编辑---
所以,从下面的建议,我增加了以下块的build.gradle的'defaultConfig块以上。
So, from suggestions below, I added the following block to build.gradle, above the 'defaultConfig' block.
buildTypes {
debug {
versionNameSuffix ".DB"
applicationIdSuffix ".debug"
}
}
至于具有不同的图标来告诉这些版本分开,现在,我已经添加了一个72x72不等#图标变体放入res /绘制,华电国际的文件夹。我在我与两个图标名称清单文件中得到了意见。我可以复制并粘贴到了android:图标线,改变图标
As far as having a different icon to tell the builds apart, for now, I have added a single 72x72 icon variant into the res/drawable-hdpi folder. I've got comments in my manifest file with both icon names. I can just copy and paste into the android:icon line, to change icons.
推荐答案
查看gradle这个公司的产品口味。你可以在两个不同的口味使用不同的包名,然后就可以在手机上同时安装这两种口味。注:以这种方式改变包的名称可能迫使其他调整(例如,如果你使用的地图谷歌一个API密钥,您可能需要让双方软件包名称明确地使用生成的密钥)
Check out gradle's product flavors. You could use a different package name in two different flavors, and then be able to install both flavors on your phone at once. Note: changing package names in this way may force other tweaks (e.g., if you use a Google API key for maps, you may have to allow both package names to use the generated key explicitly).
您应该能够做到这一点同一个包现有的调试中重命名和发布版本的类型,但我得到你想要的感觉既稳定和尖端建立是调试的变种。
You should be able to do this same package renaming within the existing debug and release build types, but I get the sense you want both stable and cutting-edge builds to be debug variants.
从文档调整了code例如链接:
Tweaked code example from the docs linked:
productFlavors {
flavor1 {
packageName "com.example.flavor1"
}
flavor2 {
packageName "com.example.flavor2"
}
}
如果你走这条路线,一定要阅读链接文件的构建类型+产品风味=构建变种的内容了。 :其他东西的gradle你应该对一个完整的画面读了的applicationID
, packageNameSuffix
, applicationIdSuffix
。
If you go this route, be sure to read the "Build Type + Product Flavor = Build Variant" section of the linked docs too. Other gradle stuff you should read up on for a complete picture: applicationId
, packageNameSuffix
, applicationIdSuffix
.
这篇关于什么是同时安装稳定和开发的应用程序版本的实用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!