How to add android library project in another android project in eclipse - android

I am trying to add a library project in another project but I am unable to add it.
I made e.g. Project A as a library project by going in to its properties and checking isLibrary checkbox. Then I tried to add this in Project B , by going into its properties , and by clicking Add button and selecting Project A as a library.
Then I clicked on ok , but when I try to use any class or reference of Project A , I get an error that it is not defined. I checked Project B's properties again , and there is no reference there of Project A, which I established earlier.
The reference is automatically disappearing. I need help in this.
Edit : Both Projects are in same workspace.

Check this please for example Facebook SDK:
and try to press Apply before press Ok

I've encountered this problem myself. The solution for was based on the location of the library project.
It needs to be in your workspace directory, "next" to the Android project you're trying to connect to it.
Is this the case for you?

You can add project A to the "libraries" folder into project B and then you should be able to use references.Every time the library you are using should be into your main project folder and not in the same workspace.Try this out.

The porblem was read-only persmissions of files of Project B. I eliminated read-only permissions and it is working now. Thanks for suggestions

Related

Error when creating android project in eclipse

I'm new in Android Developer and i learning. But when i create a new project, this error shown.
and in the error log i have so much error, and i don't know how can i export all of them here.
And In the project explorer, my project shown like this:
I don"t know how can i fix all of this error! Thanks for helping and sorry for my bad english!
UPDATE:
My problem is solved. The problem is from my appcompat-v7 project. My friends give me another link of this project and then try it again, and the problem is solved!
And tnx to all of you for your answers. :)
Following are the steps:
Paste the android-support-v7-appcompat.jar that you have downloaded in libs folder of your project.
Right click on your project, select Build Path -> Configure build path.
Select Library Tab then Add Jar option and browse your recently added v7 jar and click OK
that's it :)
Update :
see here
There seems to be a problem with your external library.
Go to project properties by right clicking on project.
Select android from left menu.
check for the appcompat library in bottom window.
If it is not there, add it from a valid path. Clean the project and run it again.
Right Click on the HDArtworks project.
Go to Properties>>Android
Then in the Library section: If you find a red cross in AppCompat_v7 then Select and remove it.
Then click ok. Now come back to the Solution explorer and select the Appcompat_v7 project. and do the clean and build.
When the appcompat_v7 project error free then again Right Click on the HDArtworks project. Go to Properties>>Android
Then in the Library section: If you find a red cross in AppCompat_v7 then Select and remove it. and click Add select AppCompat_v7 and click OK.
Now Clean and Build the HDArtwork project. It should solve the problem
Offline Method :
1.
or maybe you need Offline added this package.Download with Below Link :
http://downloads.puresoftware.org/files/android/extras/support.zip
extract this in SDK-root Folder/extras/android something like that in Windows : ( for me )
C:\Program Files (x86)\Android\android-sdk\extras\android
well, goto Eclipse and add this in your project by below method :
Right Click on your project Properties > Android,
after Restart, it worked fine.
2.
also, you can Copy this Folder (appcompat) ;
//you can find it with this Address :
C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat
or after Added above Download link, now ;
copy this Folder (appcompat) to Workspace and added with Properties > Android to your project.

Can't open Project in Eclipse

I ma trying to open the source code of Gallery2 application in of Android in Eclipse and for some reason I am not able to open it.
I did Open> Android project from the existing code and selected the Gallery2 folder that I downloaded. As soon as I do that, i see the following screen:
As we can see that next button is disabled, Finish button is disabled and it says "Select atleast one project even though the project is selected". I am not sure what to do.
Or let me ask the question another way. I have successfully imported project into my workspace. What do I do now? I am fron Visual Studio world and ideally I should be looking for a solution file and that will open the entire project. How does that happen with java Android file?
Any ideas?
Because there is already project whose name is same GalleryActivity/Gallery2 or project which have same package name already imported in your eclipse workspace.
Check all the imported projects in your eclipse project explorer
This similiar error happened to me when I imported a standard Java project, I knew it was a java project but Eclipse didn't think so. It turned out that my project was missing the project.properties file and because of that Eclipse didn't recognize my project as a Java project. In the end I imported it as default project and added java facets to it, that did the trick. I don't know if this is your case but it may be worth to have a look at it, eclipse is a bit pedantic when it comes to things like this.
you have already imported same named project in your workspace. so first check your workspace and if exists delete it. or create another workspace and try to import the project

How to import existing android project into the eclipse

I Checked out two projects from SVN(Server) both are related to each other, and i imported both to existing eclipse workspace but while launching the project, it is crashing at the home screen itself plz anyone let me know how to overcome this issue....
Check whether it is a library project? If so then right click on project-> go to properties-> Android-> check weather the library project is added into your main project or not?
File->Import->General->Existing Projects into Workspace,
Next
Select root directory: /path/to/project
Projects->Select All
If one of those projects is dependent on another, or is it's library, you will need to connect them somehow.
You will do that by right clicking on your project and then go to propreties.
There, it it's a library, go to Android and Add that project as a library.
Or you could go to Java Build Path and add a project there and manage your order and export

Can't reference an Android library into my project

I would like to use the android project PagerSliding
I have imported it into my workspace.
After that I get into MY project properties add a library, and then click apply and ok, so I get :
If I reopen MY project properties right after here's what I get (Eclipse seems to loose the reference to the library).
FYI : I did have 2 workspaces before, but now I'm using only one.
I have resolved to issue by removing eclipse, and reinstalling, seems to be a Eclipse bug when previously using 2 workspaces...
According to this question SO Link
Deleting the project and importing it again worked for me.
i had the same problem there when i try to change my workspace so this my solution:
1. import and copy all project data including library project into workspace
2. delete the old project reference by Right-click on the project-->Properties-->Android-->Library, and select corrupted library(so that waht i call it) and choose Remove
3. clean project first (to refresh ur project properties)
4. go to library project Properties-->Android-->Library and check the is library if it does'nt click Apply then OK
5. if the library project is library is already checked, first Unchecked it then Clean the library project after that do the Step 4 again
6. go to project that u want the library are in then Right-click on the project-->Properties-->Android-->Library, Add then choose the library project (it should be there) and click Apply then OK
7. if still doesn't appear clean the project once more time and that should do
thanks

"is library" project is red crossed

I am going to use "library" in "SHER" application. So I made "library" "is library" and used it in "SHER" app. by adding library:
When I look back, it is red crossed:
I am using the ABS. I had imported all the applications from the downloaded "ABS". Please help me
this means that the project cannot be found and there for you are referencing nothing.
you should remove the broken reference and import it again from the correct location
it can also mean that you removed the project referenced from your environment and you should either re-open the project or import it back to eclipse.
Select the row with the red line on it and click Remove. Then Click the Add button, and select library from the dialog box that opens to add the library project to your project, based on their current locations.
It shows that the library where it lies at which path that path doesn't exists.
You need to first remove that library. Click on that library and select Remove button.
After that click on Add button ,and select your relevant library and add it into your application.
I hope this will help you.
Thanks.
Just add the google-play-services.jar file in lib folder directly. Clean the project. Hope it helps.
I solved this problem by imported the project and it's reference all together.
(Fig 1: Enter the path and click refresh to show all projects in that folder. Check the project and it's references)
(Fig 2: Reference project path become relative, and red cross didn't appear any more.)
I don't why importing reference project separately doesn't work. The only difference I guess were the paths.
Update:
checkout this post: In eclipse, unable to reference an android library project in another android project
Red cross mean broken reference to solve that problem you should copy that library in workspace and then import that library in eclipse.
After that you can successfully use that library with green tick symbol in your project.

Categories

Resources