Android App White Labeling [closed]

拈花ヽ惹草 提交于 2019-12-04 13:45:38

问题


I am trying to find the best method for white labeling an Android application. Basically I want to be able to build multiple versions of almost the same app, each version will have different resources (e.g. drawable icons, colors, etc.) but they will share a lot of the code base. Some of the apps will have additional features as well, so they won't just be clones of each other.

One method I have thought about is separating the shared code into a library, but the issue there is that some of the shared code includes activities so I'm not sure how the resources could be changed in each app.

Another method would be clone and own, but then any bugs or changes in one repository would have to be applied to the other.

Are there any other options? What is the best practice for sharing code, including activities, some resources, and other regular java classes, between two Android apps?


回答1:


What is the best practice for sharing code, including activities, some resources, and other regular java classes, between two Android apps?

With Android Studio and Gradle for Android, white-labeling can be just a matter of setting up product flavors per customer in that one project. Your common code and default resources go in src/main/. Your additional code and resource overrides go in src/whateverNameYouGiveYourFlavorForTheCustomer/. Then, whether from Android Studio (Build Variants view, docked on the left) or from the command line, you can build the different app outputs for each customer-specific flavor.

You are also welcome to go the library route. Resources of the same name defined in an app override the resources from a library.



来源:https://stackoverflow.com/questions/29701600/android-app-white-labeling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!