Gradle "manifest requires a placeholder substitution" error but manifestPlaceholders supplies a value
<p>I'm trying to perform substitution within the AndroidManifest.xml file from the build.gradle android extension but am getting this error:</p>

<pre><code>AndroidManifest.xml:89:16 Error:
    Attribute uses-library#com.company.platform.${encoding}@name at AndroidManifest.xml:89:16 requires a placeholder substitution but no value for &lt;encoding&gt; is provided.
/Users/Company/Desktop/Checkout/android/Project/app/src/main/AndroidManifest.xml:0:0 Error:
    Validation failed, exiting
:app:processDebugManifest FAILED
</code></pre>

<p>This is a snippet of the manifest file:</p>

<pre><code>...
     &lt;/receiver&gt;
   &lt;uses-library android:name="com.company.platform.${encoding}" /&gt;
&lt;/application&gt;
...
</code></pre>

<p>And this is a snipped of the build.gradle:</p>

<pre><code>android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.company.app"
        minSdkVersion 23
        targetSdkVersion 23
        versionName cityVersion
        setProperty("archivesBaseName", "City_$versionName")
        manifestPlaceholders = [encoding: "some value"]
        manifestPlaceholders = [version: cityVersion]
    }
</code></pre>

<p>I've also tried adding the manifestPlaceholders in the buildTypes i.e.</p>

<pre><code>buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        manifestPlaceholders = [encoding: deviceEncoding]
        manifestPlaceholders = [version: cityIDVersion]
   }
    debug {
        manifestPlaceholders = [encoding: deviceEncoding]
        manifestPlaceholders = [version: cityIDVersion]
    }
</code></pre>

<p>}</p>

<p>But I still get the same error.</p>

<p>Why is there an error about it requiring a placeholder substitution when one is provided for in the manifestPlaceholders?</p>