Project library not getting added to android project - android

Iam trying to reference a Android project library to my application. I do this:-
1)File->Import->General->Existing project into workspace->Select project library->check copy to workspace.
2)Right click on project->Properties->Android-> Add-> Select project library-> Apply-> ok.
But when I again check if the library is added I get the following:-
How do I resolve this?

Make sure that your library has the same location with your project source files.
It means that if your source is on your workspace , then your library should add into workspace. If not, you should copy your lib into same folder with source then mount it again.

Make sure the library project is checked as a library.
Go to the library projects BuildConfig -> Android -> Check "is library"
Make sure your project and the library project have the same target/min SDK versions.
It's also a good idea to clean your workspace and Build the library project - Right click on library project -> "Build Project"

Try this answer:
The project name needs match the folder name on the file system. What you are seeing in the Project Properties->Android->Library Reference is a relative file system path.
Reference:
In eclipse, unable to reference an android library project in another android project
Thanks to archie-bpgc for comment

i am also facing this problem i have solve this problem like
when import lib in to workspace tick mark as show in picture (basically library project and your project both are in same workspace)
now add lib to your project and clean project

you need to import the project to workspace and the library file into the same workspace.
Then you will not face this error. Kindly the root cause is not known. But this method works.
After all this .. one more way is you can alter the project properties last line where the library file path is specified.
Thank you.

Related

Importing google-play-service library showing a red X next to this reference android

Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?
The red X means its a broken link path.
http://developer.android.com/google/play-services/setup.html
Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply
Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:
Close Eclipse
Erase all google-play-services projects from your workspace
Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace
Open Eclipse
Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project
Finally, add the google-play-services-lib to your project as a library (just like you normally would)
Hope this helps! :)
Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.
While doing a File -> Import one probably might have selected the folder,
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\
instead of
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib
Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.
got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.
create a new project
copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
Also copy layouts xml files.
now import play services you will not get this error.
I was also getting same problem.
I copied google library folder into work space and import now it's working fine.
Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.
This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example
if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace
Close Eclipse. Delete
.metadata
and
.recommaditions
folders from your workplace. Import your projects back.
You add Project in to your workspace.
Start Eclipse and import project one option is ther copy to workspace do it.
After that add google play services it also copy in to your work space
and add it your library hope so its working.

import a library into my project

I made a project and I want to use the slideMenu library but when I import it the package.R class will be undefined because the attr.xml that found in library res/values. like import offers.findme.com.R;
Try this ...
Once you download the file from site you mentioned and extract it to a given destination, all you have to do (if you're using Eclipse) is
File-->import-->Android-->Existing Android into Workspace , and select that
library location.
And to use it in your projects go to
properties>Android and add the new library.
Hope this helps...
if you use eclipse then start a new project say projectLib from library source
and then configure the build path of the project to include the projectLib and rember to export i with the app
alternatively you could copy the source and resources of your library to your project and instead of offers.findme.com.R look up for your.project.R
You should refer your library project in your android project.
import library project into your workspace and into eclipse.
Right click on your android project. goto properties. Choose android. Click add browse the library project and add the same.
Now clean and build.
For more info check the link below. The link has snap shots if you scroll down
http://developer.android.com/tools/projects/projects-eclipse.html
First you need to import the library as an Android Project.
Then you need to set it as your project's library, by Right-Click your project directory > Properties
There you can mark the library project as your project's library.
After that, Project > Clean your project.
The README file says the steps clearly.
Regards.
There are a invalid line in style.xml that prevent me to access the new library the line was id property

For Android Map api v2 Description references non existing library google-play-services_lib\bin\google-play-services_lib.jar

I have import google-play-services_lib into my workspace and Add google project into MYProject it give mr error:
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'D:\Android
Workspace\google-play-services_lib\bin\google-play-services_lib.jar' HBuddy Build
path Build Path Problem
Description Resource Path Location Type The project cannot be built
until build path errors are resolved HBuddy Unknown Java Problem
and I have already installed Google Play Service in Extras
I met this issue as well.
My solution is,
clean project google-play-services_lib firstly
then clean my project which depends on play service library
Hey i know what your problem is. I think it seems like you didn't built your google-play-services project... Try the following solution:
Import the google-play-services_lib "project" into your workspace
Add the freshly imported project to your applications build path
RIGHT-CLICK the google-play-services_lib project and select "Build Project"
Wait a few moments or "clean up" your project
Run your application and - Voila -
Please uncheck "Is Library" as follows ;
Your bin folder doesn't exist! You probably don't have permission to create a folder.
If you create a project from existing code make sure you check "Copy projects into workspace".
I found that the reference is looking at the wrong folder. It normally looks in <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/bin/ for the jar file and the file is actually inside the <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/libs folder. I couldn't find a way to change the reference link, so I just copied the jar file and the matching jar properties file from the /libs folder to the /bin folder.
I hope it helps.
My solution is,
clean project google-play-services_lib firstly
then clean my project which depends on play service library
There is another way to resolve this issue. Import google_play_services_lib project to your work space.
android-sdk/extras/google/google_play_services/libproject/google-play-services_lib
Then add the google-play-services.jar file externally.
right click on your_project -> properties ->java build path -> Libraries -> add External JARs -> select google-play-services.jar from work space ->clean ->build
It works for me.
I was facing the same issue and got it solved when I updated my eclipse Android SDK tools.
I was using version 22 and when I updated Android SDK tools to 22.0.1 the error vanished and I could build my project.
I hope this helps someone...
Check Read Only property of the Project folder.
If its checked, uncheck it and then try.

Android: Unable to include facebook sdk library project

I am working with Android API 17 on eclipse Indigo. I have cloned the faccebook sdk from github and done the facebook library project set up using the source project provided in the fb sdk.
Now I'm trying to include this library project in my android demo project. I have added it under Project properties->Android->Library section. Im seeing green color tick mark infront of the added library.
Also, i have added the same in the Project properties->Java build path->Projects.
build is successful. but when i try to install on my AVD, im getting the error, E/AndroidRuntime(748): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
Can anybody plz help me how to fix this issue.
---- EDIT ------
One more thing I have observed is, when i opened Project properties->Android window, the green tick mark is not displaying under Library section, instead I'm seeing red cross mark.
Any ideas?
Thanks,
Venkat Papana
Same thing happen for me also.. try below .. it will work..
A Best way to add External Jars to your Android Project or any Java project is:
Create a folder called libs into you project root folder
Copy your Jar files to the libs folder
Now right click on the Jar file and then select Build Path > Add to Build Path, this will create a folder called Refrenced Library into you project, and your are done
By do doing like this, whenever you transfer you project to other Computer, you will not miss your libraries which are being referenced to some space on your Hard drive.
(The facebooksdk.jar can be found at the facebook-sdk directory: <facebook-sdk>\facebook\bin)
i know this question is old But I thought that may be it can help someone.
Move the library project and the application on the same drive. Usually this is a bug in Eclipse.
I solved my problem by moving them in same drive on my computer.
You can Give it a try.
You need to make both project in same dictionary then include it using Project Properties -> Android-> Library.
This works fine.
You do not have to add this to the library project as this is not the library.
https://github.com/facebook/facebook-android-sdk is the help of the project ad the sample code for the including the project in our code. Just you need to create the app ID for the facebook by registering your api with it.
Hope this will help you in your project.
Resolved by copying the com.facebook.android source code to my project source.

Why can't I add mopub-android-sdk as library?

I want to use MoPub for putting ads in my Android app.
I have downloaded the required resources and set-up a library project (mopub-android-sdk) in Eclipse. Now I want to add this project as a library to my Android app. But when I try to do that it gives this error:
Are the mopub-android-sdk files in the same parent folder as your project? This seems like the same problem addressed in this question/answer:
In eclipse, unable to reference an android library project in another android project
Place the referencing project in the same physical folder and see if the error persists.
To get around this, don't set up the mopub-sdk as a library project.
You can simply import it as a standard project.
Go to File > Import >Existing Projects Into Workspace, find the right project and click finish.
Right click your actual project and then click Build Path. Go to Link Source and then select the location of the project you just imported.
That should resolve the issue for you without requiring you to build a JAR.
-Franklin

Categories

Resources