Android应用程序的风味,以包括输出中的某些文件APK

Android应用程序的风味,以包括输出中的某些文件APK

问题描述:

在Android Studio构建过程中是否有一种方法在基于风味的最终构建/ apk中包含特定的可绘制或任何其他文件。我拥有的是一个扩展到许多子应用程序的应用程序,这些应用程序的增加部分是因为免费和专业版本。不同的“风味”包含不同的绘图和数据文件。这主要是因为我想分离出不同的口味,因为有很多,应用程序将太大而无法将所有这些应用包含在一个以口味为基础的项目中。Android应用程序的风味,以包括输出中的某些文件APK

这是多远我与科研有: https://developer.android.com/studio/build/build-variants.html

我的应用程序分享所有版本相同的代码,我只是想将数据和图像隔离。如果我能够解决drawables构建问题,我认为口味将是一个完美的解决方案。

实例当前项目结构:

test.app1.pro 
--src 
--res 
---drawables 
---raw 
...ect 

test.app1.free 
--src 
--res 
---drawables 
---raw 
...ect 

test.app2.pro 
--src 
--res 
---drawables 
---raw 
...ect 

test.app2.free 
--src 
--res 
---drawables 
---raw 
...ect 

test.app3.pro 
--src 
--res 
---drawables 
---raw 
...ect 

...etc 

答案是Android Studio中源将得益于此: Different drawable based on build variant in Gradle

这: https://developer.android.com/studio/build/index.html

创建生成类型和风味具体来源套在Android工作室应该解决我想解决的问题。