I work on a big project at work, i have been herited 3 months ago. At the moment the project structure is like this :
Additionnaly, sometimes I do build the engine to .aar for one client who use the library without the app wrapper.
My big problem : the last developepr of this project dont good know gradle and android structure, it is some strange res added twice in Engine and App/ build script / extern lib added twice...
So, before i work on a new major version, i want to refator the build system and simplify it ! In the best world, i want to delete the lib project, add the Engine code to the App, for have just 1 project app and use power of flavors for managing specifics parts.
If i have flavors like this :
It is possible to use flavor "lib" to get a .aar ?
If you have another solution for simplify or resolve my problem, im over. Thanks in advance :)
Having, has you described it, a single application module that outputs both .aar and .apk is not possible afaik, your module has to be a library OR an application, not both. (i.e. in your build.gradle : apply plugin: 'com.android.application'
or 'com.android.library'
).
My guess here will be (Android studio 1.5.1) :
build.graddle
dependencies section : compile project(path : ':yourlibrarymodule')
)Your ressources can either be stored either in your library (usable in your lib and your app without duplication), in your app in the main flavor (usable in your 2 flavors without duplication) or in your two flavors.
Therefore, you can produce the .aar
by building your library module, and the two .apk
by building your app module.