How to assign manifestPlaceholders ONLY to the instrumentation APK

Viewed 347

I have a placeholder in my AAR's manifest. The AAR builds with no problem when I use assembleRelease/assembleDebug, but when I run my Android instrumentation tests, gradle fails to build the instrumentation APK and throws an error that looks like this

Attribute <blah-blah>@<xyz> at manifestMerger....xml requires a placeholder substitution but no value for <my-place-holder> is provided.

Just for testing purposes (and to confirm whether I can set the value of a placehoder for a specific build type), I set the placeholder value in the debug build type with this:

android { ... buildTypes { debug { manifestPlaceholders = [my-place-holder:"my-value"]

It worked (the release version keeps the placehoder and the placeholder was replaced in the debug version). However, I don't want to (and actually should not) do this because that means my debug version will override the placeholder in the AAR's manifest but I must keep the placeholder in the manifest so it can be overridden by the users of my AAR.

Does anybody knows how to assign manifestPlaceholders ONLY to the instrumentation APK?

0 Answers
Related