Pregunta

I am trying to use jfeinstein10 / SlidingMenu http://goo.gl/PEZ9M in my android application.First I have added library project of Sliding Menu, then I added ActionBarSherlock too.Sliding Menu library is dependent to ActionBarSherlock.

Also my app is dependent to SlidingMenu app.

My question is that when I add a library project as a dependency to my main project, the R file of the main project disappears and all my R references in main project cannot be resolved.

does anyone know that R file disappearance issue after adding a library project as a dependency?

¿Fue útil?

Solución

Use the Project Properties and clicking on the Android section, change the Project Build Target to Android 4.0.3 (API 15). Clean the project after changing the API Level.

Otros consejos

Ok I just struggled through this issue for quite some time now I finally resolved it here are the steps I took.

  • First of all I updated the android SDK for eclipse to the latest version.
  • Then I updated eclipse itself by going to Help --> Check for updates
  • next downloaded the latest version of SlidingMenu and ActionBarSherlock and unzipped them to a folder
  • Then in eclipse import ActionBarSherlock by creating "New Android Project from existing source" and selecting the "library" folder in the unzipped directory
  • Repeat the above step for SlidingMenu
  • Very important at this point to make sure you don't have any errors in your both imported library projects

If you have errors in the ActionBarSherlock then right click the project goto "Android Tools" --> "Add Support libraries". This should resolve any issues you have if not then goto project --> clean and clean up the project

The sliding menu will have a target of 2.2 or 2.1 by default (sorry cant remember which one...its really late and my head feels foggy :z)

Right click on the SlidingMenu project and select properties in the window that opens select target build of Google APIs 4.0.3 select ok and do a CTRL + SHIFT + O and any issues or warnings you had should go away.

With that out of the way then once again right click on the SlidingMenu project and select properties. In the window under Android scroll all the way down and add reference to the ActionBarSherlock library. Also make sure the "Is Library" checkbox is checked. Apply and ok.

Next you have to do the same for your project. Right click on it --> Properties under Android Scroll all the way down and add SlidingMenu as a library. Make sure the "Is Library" checkbox is NOT checked.

At this point I encountered Dependency errors. The problem is that in your projects "libs: folder you will have the files: "android-support-v13.jar" and "android-support-v4.jar" causing a conflict.

What I did was delete the v4 and copy pasted the v13.jar file into the libs folder of all 3 projects, my project, SlidingMeny and ActionBarSherlock.

This resolved the above issue and it worked!

Hope this helps someone so they can go to sleep at sane hours of the night! :)

I just ran into this problem and I didn't need to change my build target. What I had to do it make sure my app and any library that implemented the support Library was using the same support Library version. The easiest way to do this:

Right click on each project and library that is in question and select Android Tools -> Add Support Library... *

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top