gradle 导出具有不同资源的多个项目

Export multi project with difference resource by gradle

我有一个 Android 项目,现在我想通过 gradle 导出到具有不同资源的多个项目。谁能告诉我一些想法?

在 Android studio 中无法在同一帧中打开多个项目。但是您可以同时打开多个框架。

但是您可以为您的项目添加新的模块或库,它们可以在相同的 Window 中显示。模块可以添加为:

文件 > 项目结构 > 模块 > 依赖项

然后添加模块(android库)作为模块依赖。

是的,您可以通过 Product flavors

A product flavor defines a customized version of the application build by the project. A single project can have different flavors which change the generated application.

来自Sourcesets and Dependencies

Similar to Build Types, Product Flavors also contribute code and resources through their own sourceSets.

The above example creates four sourceSets:

android.sourceSets.flavor1
Location src/flavor1/
android.sourceSets.flavor2
Location src/flavor2/