Android工作室。为 Google Play 组织项目:相同的应用程序,不同的资产
Android Studio. Organizing project for Google Play: Same application, different assets
我开发了一个 "template" 应用程序,我想在 Google 上使用不同的名称和资产播放,具体取决于我针对该应用程序的特定域(一般,"domain1", "domain2", ...).
我在其他帖子中读到,首先要做的是为每个新应用程序更改包名称(实际上 Google Play 将其用作索引,因此不能重复)。
我看到的简单解决方案是创建一个新项目并更改包名称和资产,但这相当 "bloated"。我想知道是否有可能以某种方式使用单个 AndroidStudio 项目来生成 "template application" 和 "domain specific"。
您可以在构建文件中定义产品风格,如 general、domain1、domai2、.....
...
android {
...
defaultConfig { ... }
signingConfigs { ... }
buildTypes { ... }
productFlavors {
general {
applicationId "com.buildsystemexample.app.general"
versionName "1.0-demo-general"
}
domain1 {
applicationId "com.buildsystemexample.app.domain1"
versionName "1.0-full-domain1"
}
...
...
}
}
...
如您所见,所有口味都会有不同的applicationId
。
此外,您可以根据需要选择不同的resources
或src
或assets
。
您所要做的就是从 android 工作室打造您想要的风格。
在此处阅读更多内容。 https://developer.android.com/tools/building/configuring-gradle.html
我开发了一个 "template" 应用程序,我想在 Google 上使用不同的名称和资产播放,具体取决于我针对该应用程序的特定域(一般,"domain1", "domain2", ...).
我在其他帖子中读到,首先要做的是为每个新应用程序更改包名称(实际上 Google Play 将其用作索引,因此不能重复)。
我看到的简单解决方案是创建一个新项目并更改包名称和资产,但这相当 "bloated"。我想知道是否有可能以某种方式使用单个 AndroidStudio 项目来生成 "template application" 和 "domain specific"。
您可以在构建文件中定义产品风格,如 general、domain1、domai2、.....
...
android {
...
defaultConfig { ... }
signingConfigs { ... }
buildTypes { ... }
productFlavors {
general {
applicationId "com.buildsystemexample.app.general"
versionName "1.0-demo-general"
}
domain1 {
applicationId "com.buildsystemexample.app.domain1"
versionName "1.0-full-domain1"
}
...
...
}
}
...
如您所见,所有口味都会有不同的applicationId
。
此外,您可以根据需要选择不同的resources
或src
或assets
。
您所要做的就是从 android 工作室打造您想要的风格。
在此处阅读更多内容。 https://developer.android.com/tools/building/configuring-gradle.html