How to reference an icon from a Library Project in Application's AndroidManifest.xml

我与影子孤独终老i 提交于 2019-12-08 17:38:21

问题


I am trying to use the same application icon for all applications derived from a Library Project.

I thought that it would be as simple as implementing the advice provided in this thread, but unfortunately it doesn't work.

What I did is add to the <manifest> tag in the application's AndroidManifest.xml the following line:

xmlns:mylib="http://schemas.android.com/apk/res/com.example.baseapp"

And a few lines down the same AndroidManifest.xml file, change the typical @drawable/icon to:

   <application android:icon="@mylib:drawable/icon">

But it doesn't work!

Instead, Eclipse tells me that:

error: Error: No resource found that matches the given name (at 'icon' with value '@omlib:drawable/icon').

Apparently, referencing drawables from a layout XML and the manifest XML are not the same.

How do I reference an icon from a Library Project in Application's AndroidManifest.xml?


回答1:


Did you try with drawable/icon only ? I don't know about your setup but it works for me.

Perhaps after a good project and librairy clean up...




回答2:


For people still reading this: I believe this was fixed since SDK17.

you should write the following:

xmlns:mylib="http://schemas.android.com/apk/res-auto"

This should enable you to reference resources from library projects as well.



来源:https://stackoverflow.com/questions/6334724/how-to-reference-an-icon-from-a-library-project-in-applications-androidmanifest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!