Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Is it possible to define library module manifest placeholders in main module?

I'm adding some components to a library module manifest file. Apparently it is possible to use the ${applicationId} placeholder even though I have not declared it in the library's build.gradle file. The only place it is declared is in the main module's build.gradle.

So I though if I added a custom placeholder to the main module it would also work.

In short: this seems to work:

Library's AndroidManifest.xml:

<activity android:name="${applicationId}.LibraryActivity" ...>

Main module's build.gradle:

defaultConfig {applicationId "package.name.here"...


But this does not:

Library's AndroidManifest.xml:

<activity android:label="${customPlaceholder} ...>

Main module's build.gradle:

defaultConfig {manifestPlaceholders = [customPlaceholder:"Foo"] ...}


Is there a reason one works but not the other?

like image 696
Mister Smith Avatar asked Feb 02 '16 10:02

Mister Smith


1 Answers

Yes! We can do it!

Just add the code to library's build.gradle:

    manifestPlaceholders = [
            customPlaceholder: '${customPlaceholder}'
    ]
like image 105
ipcjs Avatar answered Nov 08 '22 09:11

ipcjs