I\'m trying to perform substitution within the AndroidManifest.xml file from the build.gradle android extension but am getting this error:
AndroidManifest.xm
I had left the ${} symbols around my value:
<meta-data android:name="net.example" android:value="${XXXX}" />
You need to add the applicationId placeholder to the application gradle. This happens with the integration of Firebase, after updating to Gradle 2.2.0-alpha1
android {
...
defaultConfig {
applicationId "com.example.my.app"
...
}
}
See: Unable to get provider com.google.firebase.provider.FirebaseInitProvider
You need to just add to the array. You are replacing it. Do this:
manifestPlaceholders = [encoding: "some value", version: cityVersion]
By declaring manifestPlaceholders twice for the same flavor/build type, your are replacing the previous one. After the previous one got replaced, your build failed because the property no longer exists.
For those of you running into manifest merger / manifest injection issues due to manifestPlaceholders
defined in your libraries manifest, the issue is coming from the fact that you need to define a value for the manifestPlaceholders
in your libraries manifest. That value is not getting overridden when you inject your real value in the consuming application. To get around this, you should only define those manifestPlaceholders
values for debug
builds in your library.
Like so:
android.buildTypes.debug.manifestPlaceholders = [
authScheme: 'clientAppReplaces', authHost: 'clientAppReplaces'
]
By doing this you will be able to build your library. While also letting the client application supply the correct values for the manifestPlaceholders
. Allowing your library to do all that heavy lifting it should. This is possible because libraries build as release builds (unless defined otherwise).
Client app build.gradle
example:
defaultConfig {
applicationId "com.app.manifestPlaceholders"
minSdkVersion 16
targetSdkVersion 27
versionCode project.ext.versionCode
versionName project.ext.versionName
manifestPlaceholders = [authScheme: 'customSchemeValue', authHost: 'hostValue']
}