My Android library project consists of four modules:
Here is a screenshot of this installation from IntelliJ:

My modules use very specific Android SDK level settings:
- base
compileSdkVersion 19minSdkVersion 14targetSdkVersion 19
- factory
compileSdkVersion 19minSdkVersion 14targetSdkVersion 19
- v14
compileSdkVersion 17minSdkVersion 14targetSdkVersion 17
- v18
compileSdkVersion 18minSdkVersion 18targetSdkVersion 18
When newer versions of Android are released, the base and factory modules can have compileSdkVersion and targetSdkVersion . However, v14 and v18 both absolutely cannot follow this example.
My modules depend on each other in a special way:
- base
- independent of any other module
- factory
- depends on the base, v14 and v18
- v14
- v18
So, when I go to build my project, I get this error:
Error:Gradle: Execution failed for task ':v14:processReleaseManifest'. > Manifest merging failed. See console for more info.
When creating through the terminal using ./gradlew build --stacktrace I get a little more information:
:v14:processReleaseManifest [/blahblah/project/v14/build/exploded-aar/blahblah/base/unspecified/AndroidManifest.xml:2] Main manifest has <uses-sdk android:targetSdkVersion='17'> but library uses targetSdkVersion='19' :v14:processReleaseManifest FAILED
And here is my v14 AndroidManifest.xml file:
<?xml version="1.0" encoding="utf-8"?> <manifest package="com.example.v14"> <application /> </manifest>
(My base AndroidManifest.xml file is almost exactly identical)
<?xml version="1.0" encoding="utf-8"?> <manifest package="com.example"> <application /> </manifest>
This mistake does not make much sense to me. First of all, I do not specify version levels in any of the four different AndroidManifest.xml files (and instead, these values are inherited through four different build.gradle ).
Secondly, I don’t have a “main manifest”. The base module is probably the closest to what I need, and therefore, how exactly the v14 module turned out to be the “main manifest”, I find it rather confusing.
Finally, if this project setup is not possible, then I am in shock. This module configuration is absolutely trivial to set up in an Eclipse style project. This is how I created the library for several months.
By the way, my ultimate goal is to have all this compiled to a single .jar file, which my current Eclipse-style project can do. I'm just trying to completely switch to gradle and not stay on a sunken ship ...
Any ideas? If necessary, I can place my various gradle files ( build.gradle , settings.gradle ...). Just trying to completely overload this post.
Edit (May 27, 2014)
A screenshot of my module configuration has been added to the top of this post.