Issue with importing slidingmenu into an existing eclipse project - android

I imported the library into eclipse by going to File>Import>Existing android Code> etc
and now i have an extra project called "library" in my workspace
Then I right clicked on the project i want to implement this library to and clicked properties, added the library project, as shown in the screenshot below. But when I click Apply/Ok i get a jar dependency error, does anyone know how I can properly use the slidingmenu library in my app? Thanks

Jar mismatches are usually due to the support v4 library jar file being in both your project and the library. To fix this, make sure the entire project and its libraries has 1 copy of the jar by deleting any others. Afterwards, reference that one copy by right clicking your project and adding that copy as an external archive.

Related

Android project jar file missing after pushing to github

I added the Google Gson jar file to my Android project by copying and pasting the gson-2.2.4 jar file to the libs folder and then right clicked on the Jar file and then select Build Path > Add to Build Path(I followed this tutorial). Then everything worked fine for me with this jar file, but after pushing to github, when my friends pulling this project, they said that all code relevant to that Gson jar file shows errors. How could I fix this?
Problem 1 : Jar doesnt exist. You probably forgot to add, commit and push your changes to github after adding the jar.
Problem 2 : Jar exists but unrecognised. Ask your friends to remove the existing library from java build path using project properties and add again.
You can create a library project which contains the jar file, and then add this library to your project.
Create library project in eclipse:
File->New->Android application project->Next->Check Mark this porject as a library,
uncheck Create custom launcher icon and Create activity->Finish
Add the library to your project:
Right click your project->Properties->Android->Add->Select the library project you created
->Apply->OK
After finishing these two, you should be able to use Gson, and when pushing your project,
remember to push the library project as well.

Add External Jar Library

I know that we should put the .jar library into the libs folder in the project directory and after that everything automatically should work fine. It fix errors in my code and importing classes but it throws exceptions.
for example when I'm using jfeinstein10/SlidingMenu library, throws
java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable
as soon as encountering
SlidingMenu slidingMenu = new SlidingMenu();
at run time. Is there any problem with my library adding process?
https://github.com/jfeinstein10/SlidingMenu is a library project.
Import your library project sliding menu to eclipse.
Right Click on the library project. goto properties. Choose android. you should see Is Library checked.
In your Android project right click goto properties. Choose android. Click Add. browse the library project add and click ok.
http://developer.android.com/tools/projects/projects-eclipse.html
http://developer.android.com/tools/projects/index.html
Refering action bar sherlock( is also a library project) in Android project.(added snapshots). Check the link below for snap shots.
import .R cannot be resolved when I import actionbarsherlock
Follow the steps for sliding menu also.
In addition to Raghunandan, this is what the docs say:
You cannot export the library project to a self-contained JAR file, as
you would do for a true library. Instead, you must compile the library
indirectly, by referencing the library in the dependent application
and building that application.
He is completely right. You cannot use the SlidingMenu as a jar file.
May be your jar file is not available at run time ,please check that first in your javabuildpathlet me clear is it a library project or its a jar.

After importing does not see the library

After importing next problem, does not see the library as I understand.Tell me how to solve the problem
Again, I imported the project, now Screen is not quite empty but not full
aaa Sorry decided I did not put the settings
How did you do the import? I'm not too sure I understand your project structure. Do you have an available JAR file of the library you need? If you do, create a /libs folder in your Android app. Build the project and the import should be available.
If you are importing a library project, right click on your main project, choose Properties then Android then under Libraries, add the library project you need.

Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

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 ....

Android Library Projects in Eclipse - Jar files doesn't show up in the r14 sdk tools

I have updated my SDK tools to r14. In this link it is told that the library projects will show up as jar files in the projects which uses the library project. But the jar files are not showing up and the <libraryproject>_src folder is still visible. While migrating to r14 from previous version is there any specific step/settings that I need to follow/change so that the library projects are included as jar files? Should I first export the library project as jar file and then include it? I would like to know if anyone has done this and how they have done it?
I got this to work.
I rebuilt the library project and a <libraryproject>.jar appeared in the bin folder. Then I removed the reference from the project which uses the <libraryproject> and added it in the same way as before.
Project properties -> Android -> in the Library section I added the reference to the <libraryproject> and it created a Library Projects in the current project containing the <libraryproject>.jar file.
Fortunately, there was no switch case statements involving the resouce IDs in my entire library projects. For those of you who is not able to get it to work right away, I would suggest them to go through the link I have posted in the Question.

Categories

Resources