timfreiheit/ResourcePlaceholdersPlugin

The plugin does not seem to support custom Manifest variables

Closed this issue · 4 comments

Using ${applicationId} works fine, but when I define my own variables like

android {
...
        buildTypes.all {
            manifestPlaceholders = [exportDebugFeatures: "$debuggable"]
        }
}

And use it in my shortcuts.xml:

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <shortcut
        android:shortcutId="debugActivity"
        android:enabled="${exportDebugFeatures}"
        android:icon="@drawable/ic_debug"
        android:shortcutShortLabel="@string/app_shortcut_debug">
        <intent
            android:action="android.intent.action.VIEW"
             android:targetPackage="${applicationId}"
            android:targetClass="com.rise.app.wallet.debug.DebugActivity" />
        <!-- If your shortcut is associated with multiple intents, include them
             here. The last intent in the list determines what the user sees when
             they launch this shortcut. -->
        <categories android:name="android.shortcut.conversation" />
    </shortcut>
    <!-- Specify more shortcuts here. -->
</shortcuts>

build.gradle

resourcePlaceholders {
    files = ['xml/shortcuts.xml']
}

It wont't get resolved

AGPBI: {"kind":"error","text":"error: \u0027${exportDebugFeatures}\u0027 is incompatible with attribute android:enabled (attr) boolean.","sources":[{"file":"...\\app\\build\\generated\\res\\resourcesPlaceholders\\....\\debug\\xml\\shortcuts.xml"}],"original":"","tool":"AAPT"}
..\app\build\generated\res\resourcesPlaceholders\...\debug\xml\shortcuts.xml:0: error: '${exportDebugFeatures}' is incompatible with attribute android:enabled (attr) boolean.
error: failed linking file resources.

i found the bug.
i only used the placeholders defined in flavors.
can you check if this works for you before i create a new release out of it?

classpath 'com.github.timfreiheit:ResourcePlaceholdersPlugin:ae7125d493'

I'll test it in the evening. Thanks for the quick reply (and the plugin)

Looks good, the variable is now resolved correctly, please update (and close) the ticket when a new version is out.

thanks. released version 0.2