Is it possible to specify extra XML fields for gradle-generated AndroidManifest. The use case, specifically, is that I have an app that uses google maps, and according to their documentation, the app must specify:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
in the AndroidManifest. If you then try to test this app with gradle, you'll get:
$ ./gradlew connectedCheck
<snip>
:myapp:processTestTestManifest
[manifestMerge1694110764542760523.xml:1, manifestMerge678902239503841223.xml:15] Main manifest has <uses-feature android:glEsVersion='0x00010000'> but library uses glEsVersion='0x00020000'
Note: main manifest lacks a <uses-feature android:glEsVersion> declaration, and thus defaults to glEsVersion=0x00010000.
My current (relevant) project structure is:
myapp/AndroidManifest.xml
myapp/project.properties
myapp/res/
myapp/src/com/magic/package/Foo.java
myapp/tests/java/com/magic/package/test/FooTest.java
In other words, the legacy project structure except for tests/
. I've also tried with adding an arbitrary AndroidManifest.xml to myapp/tests/
, even though the doc says not to, just as a test. However, I had no luck.
My buid.gradle
looks like:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile project('stuff')
}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
If I remove the uses-feature
, the tests will run, but I'd like to avoid that, if possible.
It's not possible to provide custom attribute but it looks like the merge is broken. I'll have to look into it.
Updated: Per google bug filed for this, this has been fixed via the new manifest merger. And from manifest merger user guide
This new merger was introduced in version 0.10 of the plugin. As of 0.11, this tool is used by default by the gradle plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With