使用单一代码库为不同组织提供多个应用程序 [英] Multiple apps for different organizations using single codebase

查看:22
本文介绍了使用单一代码库为不同组织提供多个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码库/项目 &我需要通过更改以下几项内容来为多个组织发布多个应用程序(代码始终相同):

I have single codebase/project & I need to release multiple apps to production for multiple organizations(Code always will be the same) just by changing few things below:

  1. 应用图标、启动画面图标
  2. 包名称、应用名称
  3. Google-service.json 文件(作为使用 Firebase 推送通知的应用)

如何以更有效的方式进行操作,以便我无需在单个项目中修改所有内容.谢谢

How can I do it in more efficient way so that I not need to modify everything in a single project. Thank you

推荐答案

使用 Build 为您的应用添加产品风格 -> 编辑风格

Add product flavors to your app using Build -> edit flavors

或者在 build.gradle 文件中添加这样的内容.

Or add like this in build.gradle file.

productFlavors {
    APP1 {
        applicationId 'example.com.app1'
        versionCode 3
        versionName '3.0.0'
        buildConfigField "com.jujama.utils.BuildType", "BUILDTYPE", "example.com.utils.BuildType.APP1"
    }
    APP2 {
        applicationId 'example.com.app2'
        versionCode 1
        versionName '1.0.0'
        buildConfigField "com.jujama.utils.BuildType", "BUILDTYPE", "example.com.utils.BuildType.APP2"
    }

}

可以在具有相同文件名的不同目录中管理多个应用程序资源

Multiple app resources can be managed in separate directories with same file names

请检查https://developer.android.com/studio/build/build-变体https://medium.com/@iammert/android-product-flavors-1ef276b2bbc1 供参考

这篇关于使用单一代码库为不同组织提供多个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆