Cannot add android.support.v7 to my project build path
Asked Answered
L

6

5

I am trying to add android-support-v7-appcompat to my project build path:

This is what I have done: Right-click on my own project -> build path -> configure build path -> choose Android on the left column and then click "Add". I choose "android-support-v7-appcompat". This name appears then in the right column of the table, on the left appears the path where the library is located: C:\Program Files\adt-bundle-windows-x86-20131030\sdk\extras\android\support\v7\appcompat. And it has a beautiful green check mark on the left!

I click Apply or Ok.

Then I go to this screen again, but though the path is still on the left in the table, there is a red cross on the left and a question mark, where "android-support-v7-appcompat" should have been. I have done exactly what is described in http://developer.android.com/tools/support-library/setup.html (title "Adding libraries with resources").

Has someone any idea????

Loni answered 11/12, 2013 at 15:24 Comment(2)
Did you build the support-v7 project?Randell
Thank you for your immediate reaction! Yes I just did clean again on the support-v7 project, but I have still the same problem with my project!Loni
M
12

the way how to preserve "green check mark" after reopen Properties window is putting your own project on the same letter drive, where is located project android-support-v7-appcompat

so if you have it located in C:\Program Files\adt-bundle-windows-x86-20131030\sdk\extras\android\support\v7\appcompat, then you have to move your own project somewhere on drive C:\ (e.g. C:\Users\User\workspace)

this work for me

Mixie answered 24/1, 2014 at 21:6 Comment(2)
This helped me. I had the support library in the drive C and my projects in another drive. Copying the support library to the other drive solved it.Preengage
This also helped me fix my setup. Really wish I knew this earlier.Merissa
B
8

Do as below:

Go to File -->Import -->Import the library project into your workspace(select the project exists here C:\Program Files\adt-bundle-windows-x86-20131030\sdk\extras\android\support\v7\appcompat).

Then Right Click on your project-->Select Android --> Add-->Select the library project you have imported.

don't forget to checkmark the library project in Project-->Right Click-->Properties-->Java Build Path--->Order and Export

Bust answered 11/12, 2013 at 15:29 Comment(4)
How do you mean this: "Import the library project into your workspace" ... "without importing the library project to workspace"???Loni
Thank you for editing. I have done all this. The problem is, that I can add the library project all right, but when I press ok and go again to this screen, then there is this red cross!Loni
@user2591089 Yes I agreed. but when you are importing the project you might not checkmark the "copy project to workspace" when you select the project. when you don't check it the project stays in its parent location and shows the error you are facing. make the library project available in the same workspace of your actual project.Bust
thank you so much!! This solved my problem, along with downloading 4.2.2 (advice of @tyczj).Loni
H
1
  • Remove all of your library projects
  • Do a clean of the project with the dependecies
  • Add the problematic library again
  • Add all of the other libraries
Harmonize answered 29/3, 2015 at 4:5 Comment(0)
G
0

you need to import the library into your workspace first then right click on the project you want to add it to and click properties and under android click add in the libraries section. select the imported library. dont import using build path

Gumption answered 11/12, 2013 at 15:28 Comment(6)
Thank you. I did this this time with project -> properties instead of project ->build path. But the same problem ...Loni
do you have 4.2.2 sdk downloaded from the ADT because that library needs that SDKGumption
Oh! I have only downloaded 4.4! Do I really need this older version?Loni
yes you do, just download the sdk and nothing else because thats all it needs. your app can still use 4.4 thoughGumption
Thank you tyczj, I will download it now!Loni
thank you, this was one part of the solution of my problem! The second was the last answer of @TNR!Loni
D
0

Select "Java Build Path" and tab Libraries instead of "Android". Click "Add external Jars..."

or

Copy the file to your "libs" folder and right click on the file and select "Build Path" -> "Add to Build Path"

Dietrich answered 11/12, 2013 at 15:29 Comment(4)
Thank you! I just tried your first suggestion. At "add external Jars" I added "C:\Program Files\adt-bundle-windows-x86-20131030\sdk\extras\android\support\v7\appcompat\bin\android-support-v7-appcompat.jar". But my project can not yet import the support library! I will now try your other suggestion!Loni
this will not work because v7 needs resources so you need to import it as a library project. you cannot just import eh jar fileGumption
You are right. You can also look here for more information and how-to developer.android.com/tools/support-library/setup.htmlDietrich
But I wrote in my question that I have all done like said in developer.android.com/tools/support-library/setup.html !! The Support library project lies in my workspace!Loni
S
0

Changing the path of eclipse_workspace folder to the same driver as the Android SDK solved my problem.

Sailplane answered 28/9, 2014 at 11:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.