我正在使用包含自定义视图类的外部库(jar)。我必须使用它来测试项目。一个在工作,一个不在。外部库中的自定义视图类不工作
非工作一个已在Eclipse以下错误上引用自定义视图的行:
error: No resource identifier found for attribute 'bar' in package 'com.example.testapp'
作为参考,布局看起来像这样(简化):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:foolib="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.example.customviewlib.MyBarImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
foolib:bar="test.bar" />
</LinearLayout>
这两个项目之间的唯一区别似乎是工作项目在“gen”下有一个名为“com.example.customviewlib”(带有R.java)的包。 IE浏览器。匹配库包名称。
我是否正确地认为它是库的缺失gen包,这是自定义视图不能在我的第二个项目中工作的原因?
如果是这样,我如何强制在我的其他项目中生成包?
我已经尝试过各种建议,例如清理项目并重新启动Eclipse。
你是如何在非工作项目中导入jar的? – ssantos