When using an Android Library Project how do you reference xml resources properly?

前端 未结 4 1162
耶瑟儿~
耶瑟儿~ 2020-12-29 20:02

I have an Android Library Project that contains several styles/themes defined in its styles.xml file.

Normally, when referencing this style in some other xml layout

相关标签:
4条回答
  • 2020-12-29 20:09

    I use IntelliJ and what worked for me is to reference the resource normally and to make sure the library is added as a dependency of the project

    0 讨论(0)
  • 2020-12-29 20:13

    I just ran into the same issue however cleaning in Eclipse did not work until I set both the library project and the regular project to have a matching : Target Build Property.

    0 讨论(0)
  • 2020-12-29 20:24

    I just had this issue in Android Studio. It seems Android Studio didn't realise my library project was a library despite the project.properties stating android.library=true.

    I fixed this issue by checking the "Is Library" checkbox in Project Structure.

    enter image description here

    0 讨论(0)
  • 2020-12-29 20:27

    Its important to build the project after adding resources (or just have autobuild on) and cleaning the project helps most of the times. Restarting Eclipse when "something" go wrong is a good idea, too.

    Also note that Android merges the recources, so the last project that is build "wins" the name. For this reason it's a good idea to prefix ALL resources somehow.

    0 讨论(0)
提交回复
热议问题