androidandroid-studiogradleandroid-gradle-pluginlibrary-project

Is it possible to add a externally-maintained project library, without copying?


I'm working with Android Studio 0.5.8.

I have a Working project, and I want to reuse all its contents to make an almost identical app with only another name and different colors.

Basically I want to make a library from the original app and reuse it in various identical apps, but I don't want to copy & paste inside each new app, I want to maintain and develop only one codebase (the project library).

I have read and read, but I can'tt find any real solution.

I tried this in my settings.gradle:

include ':AppCopy1', ':..:LibraryProject'

It works, but I cant use any classes in AppCopy1.


Solution

  • This sounds like a good candidate for Product Flavors. The Gradle build system has support for maintaining a single codebase and building multiple apps from that codebase that only differ by a few files changes. See the configuration examples here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants for details.