【问题标题】:How to merge two different projects that are already in playstore using flavors如何使用风味合并两个已经在 Playstore 中的不同项目
【发布时间】:2020-08-17 09:56:25
【问题描述】:

我面临的问题是有两个类似的项目(应用程序),将来还会有更多,当我在一个中更改代码时,我需要在其他项目中进行相同的更改。当我在网上搜索时,我发现了产品口味,但不确定它是否能解决我的问题。

如何在 Playstore 中合并两个不同的项目(应用程序)。项目代码是 %85 相似的,我可以使用风味将两个项目合并为一个,并且我可以使用具有不同包名称和一些不同权限的不同 jks 在 playstore 中更新它们。每种口味都需要 AndroidManifest 文件吗?

我该如何解决这个问题。谢谢

【问题讨论】:

  • stackoverflow.com/questions/36194748/… 另一个选择可能是将通用代码移动到一个库项目中,然后您可以在两个应用程序中使用它。
  • @Michael 嗨,感谢您的回答,您知道使用其 applicationId 更新应用程序是否足够,或者谷歌 Playstore 在基于新风格的项目中是否需要其他东西

标签: android google-play android-productflavors


【解决方案1】:

要更改 packageName,您必须创建 product Flavor like

flavorDimensions "versionCode"

productFlavors {

    doctorApp {
        dimension "versionCode"
        applicationId  "com.doctor.app"

    }
    patientApp {
        dimension "versionCode"
        applicationId  "com.patient.app"
    }
}

在将项目视图切换到项目后创建两个主目录的同级文件夹

app -> src -> main       /// write all common classes here
app -> src -> doctorApp  // doctor related classes here along with their resources
app -> src -> patientApp // patient related classes here along with their resources

patientAppdoctorApp下创建相同的package nameres folder

【讨论】:

    猜你喜欢
    • 2020-10-16
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 2010-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多