Using the new “manifestmerger” property in Android

2019-01-07 09:27发布

In the newest version of ADT (version 20 preview 3), they say that it's possible to make the libraries' manifest file become mergeable with projects that use them:

Automatic merging of library project manifest files into the including project's manifest. Enable with the manifestmerger.enabled property.

How and where do I use it? I can't see content assist helping with me on this anywhere.

4条回答
姐就是有狂的资本
2楼-- · 2019-01-07 09:52

I was facing some errors during manifest merging (R.java file went missing) so alternately I explicitly copied the manifest contents (e.g. I copied just the activity contents) from the library project manifest and put them in my main project manifest. That resolved the error and everything seems to be working well so far. Let me know if anyone feels this is not a recommended alternative to manifest merging.

查看更多
Fickle 薄情
3楼-- · 2019-01-07 09:55

If you want to merge android library project manifest and your current project manifest, you have to add manifestmerger.enabled=true in your project.properties file where you referred your library project. But, you should be confirmed some point like ADT version, Also Minimum and target SDK should be same as library project.

查看更多
做个烂人
4楼-- · 2019-01-07 09:56

FYI: manifestmerger.enabled=true won't merge the manifest files if you are using eclipse export signed App. As noted here it seems to be a bug. http://code.google.com/p/android/issues/detail?id=34623

It was a bit of a hassle for me to set up merging correctly as well. (restarting eclipse, open close project..) To find out if merging is working take a look at the file in ../Your_Main_Project/bin/AndroidManifest.xml. If merging worked you will see the complete result in this file.

EDIT: This bug was fixed in ADT v20.0.1 (Juli 2012): http://developer.android.com/tools/sdk/eclipse-adt.html

查看更多
成全新的幸福
5楼-- · 2019-01-07 10:03

Add the following line to your project.properties file of your application project.

manifestmerger.enabled=true 

Introduced with Android SDK Tools, Revision 20 (June 2012):
https://developer.android.com/studio/releases/sdk-tools

Build System
    * Added automatic merging of library project manifest files into the including project's manifest.       Enable this feature with the manifestmerger.enabled property.

查看更多
登录 后发表回答