Android 使用库项目时的一个特殊tip

前提:

项目A作为库项目被项目B引用,但是项目A中有自定义的控件和自定义的属性,当在项目B中使用自定义的属性时,编译时就会直接报错:No resource identifier found for attribute 'xxx' in package 'com.XXX'。

 

这个问题,我以前的解决方法是,将项目A的包名和项目B的包名保持一致,就可以了。

但现在有个更好的办法:

 

QQ截图20140409161536

 

 

参考地址:http://stackoverflow.com/questions/16194928/issues-when-referencing-android-library-project-with-user-defined-attributes

                   http://stackoverflow.com/questions/4506294/android-library-projects-and-styleable-resources

                   http://stackoverflow.com/questions/4461407/help-with-a-custom-view-attributes-inside-a-android-library-project

 

后来发现在ADT 17.0.0  版本更新的时候 说了这个问题 :

 

http://developer.android.com/intl/zh-cn/tools/sdk/eclipse-adt.html

posted @ 2014-04-09 16:30  指鹿为驴  阅读(231)  评论(0编辑  收藏  举报