从Android的库项目R.java文件不能导入到应用程序项目 [英] R.java file from Android library project not importing into application project

查看:119
本文介绍了从Android的库项目R.java文件不能导入到应用程序项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟着指示这里就如何创建一个Android库项目,并用它在Android应用程序:

I followed the instructions here on how to create an Android library project, and use it in an Android application:

<一个href="http://developer.android.com/guide/developing/eclipse-adt.html">http://developer.android.com/guide/developing/eclipse-adt.html

但它不能正常工作。我可以看到该库项目被添加到我的应用程序,但我在那里不能引用任何东西,因为它不会建。从lib中R.java文件不被添加到我的应用程序的项目,所以LIB项目包含吨的错误,随处可见它试图引用它自己的R.java文件。

but it is not working. I can see the library project is added to my application but I cannot reference anything in it because it won't build. The R.java file from the lib is NOT being added to my application project, so the lib project contains tons of errors, everywhere it tries to reference it's own R.java file.

我不知道这有什么关系,但在控制台中也有一些消息,指出有没有发现属性的X,包库包资源标识符。我的图书馆包装有对于自定义视图我做了定义AA几个设置样式属性,所有这些都被抱怨在这个控制台消息。图书馆建立蛮好的,我没有得到这些消息在控制台中,直到我勾图书馆我的应用程序,所以我不知道什么是与此有关。

I don't know if this has anything to do with it, but in the console there are messages stating that the there is "No resource identifier found for attribute 'X' in package 'Lib Package'. My library package has a a few styleable attributes defined for a custom view I made, all of which are being complained about in this console message. The library builds just fine, and I don't get those messages in the console until I hook the library to my application, so I don't know what's up with this.

我真的想获得这个工作。我花了整个天就可以了,没有用。请提供任何想法,你可能有帮助!

I really would like to get this working. I've spent two entire days on it, to no avail. Please offer any ideas you might have to help!

推荐答案

这个问题的答案我的难题是,库中有这样的定义,我创建了一个自定义视图几个自定义属性的attrs.xml文件。我删除attrs.xml和硬codeD上的自定义视图code的值,重建了图书馆和问题就解决了​​。

The answer to my conundrum was that the library had an attrs.xml file that defined a few custom attributes for a custom view I created. I removed attrs.xml and hardcoded the values in the custom view code, rebuilt the library, and problem solved.

这是不冷静的,虽然,这是什么意思的是,自定义属性自定义视图不能在图书馆中使用。我希望谷歌修复了这个。

This isn't cool though, what this means is that custom views with custom attributes can't be used in libraries. I hope Google fixes this.

这篇关于从Android的库项目R.java文件不能导入到应用程序项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆