Eclipse Version: Helios Service Release 2
Build id: 20110301-1815
I have imported the ViewPagerIndicator library into Eclipse
File->New->Android Project... Named project ViewPageIndicatorLibrary
Create project from existing source
Select source
C:\Android\development\workspace\Android-ViewPagerIndicator\library
Added compatibility library and Project builds correctly.
Project properties 'Is Library' checked. Everything fine.
In the project I want to use ViewPageIndicator, select properties.
Android Properties -> Add Library and the ViewPageIndicatorLibrary library project is available for selection.
Select the ViewPageIndicatorLibrary and it appears with green tick with a reference path of "C:\Android\development\workspace\ViewPageIndicatorLibrary"
everything appears OK.
Close the properties, reopen properties and the Library reference appears with a red cross alongside.
The Reference path appears to be correct (points to same root of the ViewPageIndicatorLibrary project as just added)
"C:\Android\development\workspace\ViewPageIndicatorLibrary"
Project name displayed as '?'.
Eclipse seems to be losing the link to the ViewPageIndicatorLibrary project.
Import references to com.viewpagerindicator.* fail to resolve.
project.properties of the main project shows
# Project target.
target=android-8
android.library.reference.1=C:/Android/development/workspace/ViewPageIndicatorLibrary
So the reference path is absolute and correct.Any ideas?
I just want to get on and use this library, but it's not playing. Deleting/re-creating library project several times now - same results, Eclipse loses link when Properties dialog is close.
I faced the same problem with google-play-services_lib. This problem occurred after I created a second eclipse workspace and copied some projects including that library.
In this situation, I had the google-play-services_lib in each workspace folder. I then deleted one folder, fixed the project setup (Android Tools) and cleaned the project in question. That solved the problem.
Might be an Eclipse bug (Juno 4.2.1).
Related
I am having problems getting start with the ActionBarSherlock. I downloaded the 4.1.0 version and followed the following tutorial for installing it.
http://www.youtube.com/watch?v=4GJ6yY1lNNY
The Problem I am facing is whenever I make a new project and add the library project of ActionbarSherlock to it. I get the following error.
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'C:\Work\JakeWharton-ActionBarSherlock-4.1.0-0-g9598f2b\JakeWharton-ActionBarSherlock-88fc341\library\bin\com_actionbarsherlock.jar' myapp Build path Build Path Problem
Please anybody help me with it.
I just had the same problem: A .jar file is requested, but non-existing. Also, it is okay that the file doesn't exist, because we want to use a Android-Library Project and not an included jar-library.
The steps described by Aqif Hamid are perfectly fine, if the missing import (.jar or library project) would be the root of the problem. But i figured out that the reason for this error is that you have to set both projects (AndroidBar Sherlock and your own Android project) to Java Compliance Level 1.6
To do so go into Project Properties => Java Compiler and set the level to 1.6
Of course, you have to install JDK 1.6 on your computer...
Hope this helps you too!
The only thing that it works for me was selecting at Properties at Java Compiler Tab Compilance Level --> 1.7 (It was 1.6).
After that Android Tools, Fix Project Properties
DO the followings:
just like you have bin, res folders. right click on your project and
add a folder named 'libs' (if libs folder is not already there).
Then copy paste your com_actionbarsherlock.jar file in this libs folder.
Right-click on your com_actionbarsherlock.jar file and click Add to Build Path.
Now clean and build your project. You should be good to go.
Edit:
To add project as a library do this:
Make sure you have your library project in your projects list and it
is open.
Right click on your project in which you want to add your library
project and select Porperties.
Click Android in properties windows, now scroll down, you will see
library section at the bottom. There press Add button.
Now a window will open in which you will see list of library
porjects. Select your required project and press Ok. Now that library
project must be there with a green tick mark.
Press Apply and Ok button.
You should be good to go now.
regards,
Aqif Hamid
I am of the understanding that you cannot include ActionBarSherlock into your project by adding a jar to your lib directory (or just including the jar at all). You will have to create an android project for ActionBarSherlock then link to it as a library:
Create ActionBarSherlock project in Eclipse
Right-click your project and go to Properties
Select Android in the left pane
Then in the right pane, towards the bottom you can Add... the ActionBarSherlock project you created in step 1.
If you are curious why the jar approach doesn't work, I give you Jake's reply in this thread
(although that's a month and a half old at this point).
1 - create a libs folder (parallel to manifest) and put the jar in that
Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar ->
yourjar.jar
This video might be useful in case you are having some issues.
http://mobile.tutsplus.com/tutorials/android/jar-for-android/
Clean your actionbarsherlock project. It will generate the .jar file for you when it re-builds.
Using the Android Tools option to Add compatible libraries fixed the problem for me.
I'm working on a team project. I included a .jar file in Build Path and committed to SVN. When I updated code in my working directory, a new folder appears in Eclipse called "Android Dependencies". If I let it be there, my program runs; If I remove it, my program reports a ClassNotFoundException.
Now how to fix this ClassNotFoundException?
For the people whose heart dropped when they read the comment that deleting the Android Dependencies virtual folder will destroy your project, there is an easy fix.
Right click on the destroyed project
Select "Android Tools > Fix Project Properties" in the dropdown
I hosed my project dependencies when trying to set up my git repo, and this is fixed it.
Android Dependencies is a virtual folder where Eclipse shows what JAR files the project depends on. It's not a physical folder; you won't find it on your hard disk. And the folder is not checked in into Subversion.
Do not delete that folder. You will destroy your project.
To fix it, just revert to an older Subversion revision and check it in again.
I've had a similar problem after setting up a git repo with my project.
The problem was that the appcompat import lost its folder reference.
If the 'Fix Project Properties' mentioned doesn't work for you try this:
Go to Project > Properties
Go to the 'Android' tab
Under 'Libraries', if there's a red 'X' next to the appcompat folder, remove
it then hit 'add' and add it in again. The reference should show a
green tick now.
Save and clean the project if needs be
If you also have marked project build target below API level 16 in the Android project properties, the error is going to come because prior to this level, there was no Android dependencies.
I'm trying to get ActionBarSherlock and the ViewPagerIndicator libraries set up for my projects, but I seem to be running into a few issues. I sent Jake Wharton (The developer) a few messages earlier about it, and got a few replies but couldn't get anywhere - and I think he got busy with a few other things.
What my issue is, For both VPI and ABS
Both libraries open up without any errors, and I'm using compiler version 1.6 for all as is required.
The funny thing is, if I load in the samples that are provided - they work fine and link to his library; but when I go to add the library to my project - the above happens.
Where to store the actual library project does not matter, as long as you use a relative link to reference it. Check out the Library Projects - Development considerations:
Library project storage location
There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as the application project can reference the library project by a relative link. What is important is that the main project can reference the library project through a relative link.
You should always use the Eclipse ADT plugin to select and set up Library Project Reference, i.e. right-click project -> Properties -> Android -> Add, then in the opened Project Selection window, select the Library Project list here (of cause you should import them in the same Eclipse workspace as your Main Project). This will add a android.library.reference using relative path into project.properties as well as show relative path in the Android preference window:
android.library.reference.2=../../../../../Documents and Settings/yorkw/Desktop/JakeWharton-Android-ViewPagerIndicator-f09acb0/library
If you directly alter it using absolute path from project.properties as below:
android.library.reference.1=C:\\Documents and Settings\\yorkw\\Desktop\\JakeWharton-Android-ViewPagerIndicator-f09acb0\\library
Then after Eclipse refresh your project, you get the exact error described in your question, see my screenshot below:
Hope this helps.
While importing the libraries, make sure that you tick the "Copy projects int workspace" check box. The library projects need to be in the same workspace for them to work.
delete and import the project and lib again. build the lib project , add lib to project, still error shows.. rename the lib project. this worked for me ....
As I was writing up this question I managed to solve it so repeat it here for the benefit of others. Here is the initial problem:
I have created a very simple library project which I want to reference in another project. I have done this previously with no problems so not really sure why it is not working this time. I have:
Flagged the library project via project properties. The default.properties file has this set : android.library=true
In my other project added reference to my library project via project properties. The default.properties file has the reference added as expected ie android.library.reference.1=K:/android_test_ws/applicationRegistrar
The green tick against the referenced library project starts off green and then changes to a red cross.
This implies that there must be something wrong / missing from the library project but I don't know what. My library project on this occasion is MUCH simpler than the previous one I created.
OK Here is the solution which I found when I was looking for the default.properies file of the referencing project (not the library) in my file system. Although the referencing project was in the same eclipse workspace as the library project, the actual files were somewhere else in the file system ie they were'nt in the same parent folder of the library project. As soon as I placed the referencing project in the same physical folder as the library project it all went fine.
I guess that this must be something to do with android using ant underneath the covers.
Edit: 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.
Make Sure both the projects are present in same work space.
To Do it, while importing the projects make sure "copy project into work space" check box is checked.
the same problem will occur if your library project is in different partition from your current workspace. I have the same problem just now. My git source is in C: and I just move my workspace to D: and everything start to collapse.
Simplest way to get the library paths paths correct is to use the GUI from Eclipse to add the library as shown in the following screenshot and let Eclipse take care of putting the correct relative paths in project.properties. Its a common setup to have your library projects hosted at directories vastly different than your main projects that uses the library. This method will work if the "libary project" and the project using it are in the same eclipse "workspace" (they "need not" be in same parent folder):
Please ensure that the library project is marked as "Is Library" - right click on the library project - properties - Android - mark the "Is Library" checkbox - in project.properties of the library project you should have a new entry:"android.library=true. Now add it into the project you want as described in the post below.(the post with image integrated - from Nilesh Pawar).
This bug is referenced several times here 27199, 35786, 36460 & 38052
Maybe by voting for them, it will be fixed one day...
Yet another observation on the same issue.
For me the two projects where on the same parent folder, and were both local inside the workspace. Even then the issue was still happening.
The I edited the "project.properties" file and put the absolute path(with forward slashes '/' for seperator) of the library project. Saved and closed it. Then went to the project properties dialog, removed the library(which was still showing the cross icon but with abs path) and added it back as usual.
Surprisingly the issue is resolved, and the project compiles and runs.
This is really strange and must be a bug with the ADT.
I am using ADT version 20.0.2
when developer referencing the facebook or any other library project then first of all clean the project from eclipse->project->clean project.
that want allow the error of red cross in referencing screen.
For me, I just restart the eclipse and the added library works fine.
I mean first time it showing red marks after adding the library project.
Though eclipse main project and library project are in same workspace folder and no resources files are in outside of the project folder.
So, you can try with to restart your eclipse. Happy coding....
Workaround for me was to
Create a new workspace
Import Library Project in that workspace
Import The desired project in that workspace
Having both project and library project the same target Android OS version
Reference library project in my project
solved my problem
i had the same problem there when i try to change my workspace so this my solution:
import and copy all project data including library project into workspace
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
clean project first (to refresh ur project properties)
go to library project Properties-->Android-->Library and check the is library if it does'nt click Apply then OK
if the library project is library is already checked, first Unchecked it then Clean the library project after that do the Step 4 again
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
if still doesn't appear clean the project once more time and that should do
Just restart your eclipse. It's solve my problem
When you have a look at the reference-path before and after, it comes from i.e. "C:/workspace/mylib" and goes to "../../mylib" when copied to the correct location, quite interesting.
FYI,
What worked for me was to delete the 'library' projects (the actual projects) from my workspace (without deleting the files), and then re-importing them using the wizard (import existing android project from source code).
Thanks for posting the question.
I had exactly the same problem while integrating Facebook with my Android application. I fixed the issue by moving my development project to the same Windows drive in which library project was located. Somehow Eclipse is unable to read the library project's location properly from default.properties file if it is in a different drive.
Similar to Sufi Khan's post I also solved this issue with a reboot. My case differed in that when I first accessed Properties->Android and added the library I got a lovely green checkmark. When I closed the dialog Eclipse was still showing class-not-found type errors. When I checked the properties again I saw the red X. But Mr. Kahn's solution (delete the bad lib, restart Eclipse, add the lib again) worked fine.
I'm using the 0702 version of the ADT bundle (starts with "cluster", rhymes with "duck").
I followed the accepted answer but also had to make sure my "project.properties" file was readable.
If the file is readonly (checked into source control) eclipse will not edit it. Adding the library reference will succeed, but the change won't be persisted after hitting OK.
If closing the preferences window and reopening in again removes the library you just added, this may be your solution.
In case your library project still doesn't show up try adding library flag in your library project properties
Add android.library=true
project.properties
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
android.library=true
I'm following the instructions found at http://developer.android.com/guide/publishing/licensing.html
I made a copy of the <sdk>/market_licensing directory, then using the New Project Wizard in Eclipse I created a new Android project from Existing source and pointed it at the library subdirectory in my copy of market_licensing.
I've checked the "is Library" box in the market_licensing project android properties.
I've added that project as a library project in my app project. It shows up in the list with a green checkmark.
When I save the project settings and rebuild, the compiler can't find the classes in the LVL project and when I go back into my app's project settings the entry in the libraries list now has a red X instead of the green checkmark.
I don't understand what I'm doing wrong which is preventing me from referencing the LVL project. Any help?
EDIT: I've tried adding the licensing project to my build path for my app project and then I'm able to build, but when I try to run the app crashes because it can't find any of the library code. So clearly the "library" status of the licensing project is not set up correctly and/or its not being automatically injected into my app project on build.
I was posting up a similar question and as I did so realised what the problem was - see here In eclipse, unable to reference an android library project in another android project