android-support-v7-appcompat library project won't work
Asked Answered
F

3

5

I am trying to add Support Library v7 to my clean android project as support library (with resources). I followed every instruction here: http://developer.android.com/tools/support-library/setup.html#download and android.support.v7.* package is not visible in my main project.

Here is library reference in main project:

Library reference in main project

Support library project tree:

library project tree

Support library project build path: library prject build path

And finally, my main project tree

main project tree

I don't see any errors in Problems tab, app compiles and runs normally but i cannot import android.support.v7 package which apparently isn't in build path in main project. I went through instruction twice in clean projects/workspace. I cleaned project, restarted Eclipse and nothing... All resources from library project are unreachable too.

Thanks in advance :)

Fyrd answered 7/11, 2013 at 16:43 Comment(5)
is your app compact library in the same folder as your android project?Earthy
No, it's under android-sdk directory: C:\Users\pawel\AppData\Local\Android\android-sdk\extras\android\support\v7\appcompatFyrd
try copying the appcompact to the folder where your android project and just import into eclipse. Now reference the same. but to me it looks like a broken linkEarthy
Ok, it worked. Thank You, i've lost like half a day to figure it out. Please, write proper response and i'll accept it tomorrow morning. Bye!Fyrd
this is quite similar to developer.android.com/google/play-services/setup.html and if it helps you can mark the answer an acceptedEarthy
E
8

Copy the library project to the folder where your android project is.

Select File > Import.

Select Existing Android Code Into Workspace and click Next.

Browse and import the same to eclipse

Once the library project is imported you can refer the same in your android project.

This is similar to setting up google play services in eclipse described here. Check the 4th step

http://developer.android.com/google/play-services/setup.html

Earthy answered 7/11, 2013 at 17:11 Comment(3)
A gotcha, please make sure that both your android project and android-support-v7-appcompat are copied in the same workspace.Cantoris
@AndrewLobley there is option of copying the same to workspace in eclipse. You just have to check the checkbox though.Earthy
That's true, but that is all I am saying. They must be in the same folder.Cantoris
G
4

It looks like android-support-v7-appcompat.jar is missing from your libs folder.

When you download the Android Support Library through the Android SDK Manager it makes the support .jar files you need available under {SDK Location}\extra\android\support.

To use the v7 files, copy these to your project's /libs folder.

  • android-support-v4.jar
  • android-support-v7-appcompat.jar
  • android-support-v7-gridlayout.jar (*if needed)
  • android-support-v7-mediarouter.jar (*if needed)

Typical gotchas (this looks OK in your setup):

  • Make sure the min SDK is at least API 7
  • Make sure the project target build is at least API 17

For more information about using the support V7 package (including running the v7 samples) can be found at the RHM Guide to Android Support Lib.

Gaal answered 20/3, 2014 at 12:29 Comment(0)
P
0

The issue seems to be in Absolute path in case of Windows base machine. I faced the issue of referencing support libraries When I moved Eclipse and related libraries to different drive than where the project was. Copy paste the libraries to folder on same derive in a way that it can pick by relative path. ..\androidCommonlib\appcompat android.library

Prem answered 25/4, 2014 at 5:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.