如何使多个工作站在一个Android设备上构建兼容的应用程序 [英] How to make multiple workstations build app compatible on one Android device
问题描述
我有多个android dev工作站,我在这些工作站上工作以构建Android apk并将其部署在一台Android设备上.每当我更换工作站时,都必须从设备中删除该应用程序,然后用新的应用程序重新安装.因此,重新安装后将删除所有缓存.我想知道是否有一种方法可以处理多个与一台android设备共享的工作站,而无需重新安装.我认为在多个工作站上一定有一些独特之处.
I have multiple android dev workstations and I work on them to build Android apk and deploy them on one Android device. Whenever I change a workstation, I have to remove the app from the device and reinstall it with a new one. So all caches are removed after reinstall. I wonder whether there is a way for me to deal with multiple workstations sharing with one android device without reinstall. I think there must be something unique across multiple workstations.
推荐答案
之所以会发生这种情况,是因为不同的工作站具有不同的调试密钥库.您可以实现预期的行为,如下所示:
This happens because different workstations have different debug keystore. You can achieve your intended behavior as follows:
- 您可以创建自己的密钥库(遵循 SO 进行创建)),请在您的存储库中进行检查.将此密钥库放置在您的项目目录中.
- 更改调试配置以使用此新密钥库.这将确保您的调试应用在所有开发工作站上都使用相同的密钥库进行签名
- You can create your own keystore (follow this SO for creating it), check it in your repository. Place this keystore in your project directory.
- Change your debug config to use this new keystore. This will ensure your debug app is signed with same keystore across all your dev workstations
要执行以下操作,请更改您的 build.gradle
:
To do that change your build.gradle
as follows:
android {
...
signingConfigs {
defaultConfig {
storeFile file(getRootDir().getPath() + "\<file-name>.keystore")
storePassword <your password>
keyAlias <your alias>
keyPassword <your password>
}
}
buildTypes {
debug {
signingConfig signingConfigs.defaultConfig
...
}
}
}
- 提交代码并在所有开发人员工作站之间执行拉取.
这篇关于如何使多个工作站在一个Android设备上构建兼容的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!