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?

8
  • Are you accessing max_results from your main project? And if so is max_results in your library? Commented Nov 2, 2012 at 14:54
  • max_results is in my library, but I'm not accessing it from the main project, just from the library project. Commented Nov 2, 2012 at 14:55
  • Did you have these errors before you converted it to the library? Commented Nov 2, 2012 at 14:58
  • No, that's why I don't understand why I'm getting them now. Commented Nov 2, 2012 at 15:01
  • 2
    Did you try cleaning the projects? Commented Nov 2, 2012 at 15:02

5 Answers 5

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I updated my version, changed the namespace, and am still getting the same errors...
1

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

Comments

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.

2 Comments

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.
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).
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.

Comments

1

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.