简体   繁体   English

如何开发相同应用程序的生产版和测试版,以便在同一设备中安装

[英]How to develop a production and beta versions of the same application for installing in the same device

I am developing an Android application and the time has come where new features should be tested in the same environment that serves the production app. 我正在开发一个Android应用程序,现在应该在为生产应用程序提供服务的同一环境中测试新功能的时候到了。

I have tried creating a new branch and renaming it to .testing in the manifest and gradle files, but I am havin issues with the provider, specifically stating: 我已经尝试创建一个新分支并将其重命名为清单和gradle文件中的.testing,但我对提供者有疑问,具体说明:

I/dalvikvm: Could not find method android.app.Fragment.setSharedElementEnterTransition, referenced from method com.corp.app.AccountFrag.access$super

So I don't think this is the approach. 所以我不认为这是方法。 I want the application to be installed in its two variants (they don't necessarily need to share data) and the user to open one or the other depending whether new features need to be tested in the production environment or the more reliable, stable version needs to be run. 我希望应用程序安装在两个变体中(它们不一定需要共享数据)和用户打开一个或另一个,这取决于是否需要在生产环境中测试新功能或更可靠,更稳定的版本需要运行。

Has anyone dealt with this problem before? 有没有人以前处理过这个问题? I suspect I need to look into flavors, but I don't know. 我怀疑我需要研究口味,但我不知道。

Thanks in advance for the insight. 提前感谢您的见解。

Use should use a different build type for beta. 使用时应使用不同的构建类型进行测试。

In build.gradle of your app module, 在app模块的build.gradle中,

android {

buildTypes {
        beta {
            applicationIdSuffix ".beta"
            versionNameSuffix "-beta"
            resValue "string", "app_name", "Beta App"
        }
        debug {

        }
        release {

        }
    }
}

Here, we are adding a suffix "beta" to the applicationId of your app. 在这里,我们在您的应用的applicationId中添加后缀“beta”。 So you can have 2 variants of your app. 因此,您可以拥有2个应用程序的变体。 If you want more than 2 variants in single mobile, simply add another variant with different suffix. 如果您想在单个移动设备中使用2个以上的变体,只需添加具有不同后缀的另一个变体。

To use the package name in AndroidManifest, use ${applicationId} instead of com.example.dinesh . 要在AndroidManifest中使用包名称,请使用${applicationId}而不是com.example.dinesh If you want to use the package name in java classes, use BuildConfig.APPLICATION_ID . 如果要在java类中使用包名,请使用BuildConfig.APPLICATION_ID

Product Flavors should not be used in this case. 在这种情况下不应使用产品调味剂。 Product flavors are used, when you have two types of same product, like normal app and a paid app. 如果您有两种类型的相同产品,例如普通应用和付费应用,则会使用产品口味。 To have beta of your app, you should use Build types. 要获得应用的测试版,您应该使用构建类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM