2

I converted one project to a library project and linked it to the other, but I'm getting these errors (SearchFacebook is the library project):

[2012-11-02 16:29:10 - FacebookFollower] G:\AndroidProjects\FacebookUpdaterFollower\SearchFacebook\res\layout\test_results_auto_complete.xml:2: error: No resource identifier found for attribute 'categories' in package 'shira.android.facebook.updaterfollower.search'
[2012-11-02 16:29:10 - FacebookFollower] G:\AndroidProjects\FacebookUpdaterFollower\SearchFacebook\res\layout\test_results_auto_complete.xml:2: error: No resource identifier found for attribute 'max_results' in package 'shira.android.facebook.updaterfollower.search'

I checked the R file and the resource identifiers are there, and I'm not getting these errors when the linked project is compiled as a stand-alone project (not a library).

By the way, can I link an Android project without converting it to a library?

UPDATE: As was suggested, I changed the namespace of the custom attributes where they are used. My layout file in the project that uses the library now looks like this (the relevant parts):

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp"
xmlns:search="http://schemas.android.com/apk/res-auto">

<shira.android.facebook.updaterfollower.search.FacebookResultsAutoComplete 
    android:id="@+id/followed_type_auto_complete" android:layout_width="match_parent" 
    android:layout_height="wrap_content" android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" android:hint="@string/followed_type" 
    search:max_results="15"/>

However, I'm still getting the same errors as before, and I updated the Android Tools to the latest version, so what can be wrong?

user940016
  • 2,878
  • 7
  • 35
  • 56

5 Answers5

1

It's likely that you're stuck with a known bug caused by custom attributes in library projects.

http://code.google.com/p/android/issues/detail?id=9656

Luckily, there has been a fix introduced with the r17 android tools. Comment 71 on the issue should point you to a working solution.

forgemo
  • 4,634
  • 5
  • 22
  • 25
1

Maybe The class which use the method, needs to be import that packages

aricherca
  • 125
  • 2
  • 11
1

Need more information about your implementation. you can provide code snippet(not complete) here to support your question.

  1. provide two of your packages(main,lib) you are using.(need not to be original).(MUST BE UNIQUE)
  2. make sure you have not repeated the same resource ids in library project as well as in main project.(in case choose different)
  3. check your import package query for R file. (It's very important) where the correct R file imported.

When I was working with library projects the R file got imported very often as android.R and I resolved after a long time by importing with it's relevant R file.

Hope this will help you.

Ajay Kumar Meher
  • 1,932
  • 16
  • 24
  • How can I change a resource ID? And I'm using explicit reference to any resource which is not in the same application package, so I don't need to import the R file. The layout file which causes the errors is attached above. – user940016 Nov 08 '12 at 18:57
  • here Importing R file means "In case your IDE imported wrong(Default) R file and you might be expecting something else." That's what I wanted to be sure. Anyways sorry I missed about your custom attribute. In my project I have not used custom attribute :(. So what I suspect is your problem might be due to that custom attributes. Try copying attribute xml to your main project(not tested from my end). – Ajay Kumar Meher Nov 09 '12 at 05:41
1

Navigate to the library project gen and remove it's entire content. Do the same for the main project. Choose project -> clean from the eclipse option menu. When all is done choose build and see if the error occurs.

MaTriXy
  • 1,659
  • 1
  • 20
  • 27
1

Try exporting the project as jar and then use it in the other project as a jar file. Hope this helps..

Chandrashekhar
  • 498
  • 4
  • 19