Android Studio: is it possible to populate the manifest of the library module in the main module?

I am adding some components to the library module manifest file. Apparently, you can use the placeholder ${applicationId} , although I did not declare it in the library's build.gradle file. The only place announced is in the main build.gradle module.

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

In short: this works:

AndroidManifest.xml library:

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

The main build.gradle module:

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


But this is not so:

AndroidManifest.xml library:

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

The main build.gradle module:

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


Is there a reason to work, but not another?

+5
source share
1 answer

Yes! We can do this!

Just add the code to the build.gradle library:

  manifestPlaceholders = [ customPlaceholder: '${customPlaceholder}' ] 
0
source

Source: https://habr.com/ru/post/1242080/


All Articles