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.
Related
I'm trying to use
Android PagerSlidingTabStrip v1.0.1library
in my project but, after I import the project as existing code in work space I get to project
the Mainactivity and library and and the library is a dependency to the Mainactivity
but it seems that library project doesn't recognized as local library
so what i did is
1- I tried to make a jar file called library.jar from the library project
and I imported as a external jar so that fixed my import but when I try to use PagerSlidingTabStrip object it says missing reference
and beside that there is res folder couldn't be loaded .
2- I follow this How to add a Library Project to a android project
and I did like what the accepted answer said but it still didn't work for me .
This is how I added the library project
That what I got in project libraries
I tried to use this dependency in build.gradle
dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
}
but it didn't work
i added before sherlock to eclipse so when i added it inside the root folder
a bin folder created and inside it there are a jar file and that's
doesn't happen with library so i think here is the problem
any help?
From properties window select option android scroll down, below library heading click the add button and select library project.
I was facing the same issue but soon i came to know that there was support library missing from Library project.
Add support library and clean build the library project and then add it in your project
Do the following:
File->New->Other
Select Android Project
Select "Create Project from existing source"
Click "Browse..." button and navigate to "PagerSlidingTabStrip-master" folder which you have downloaded from https://github.com/astuetz/PagerSlidingTabStrip
Check "library"! (Uncheck "sample"). Make sure "Copy to Workspace" is checked as well.
Click Finish. Now "library" is project in your workspace.
Right-click on your project -> Properties
In Android -> Library section, click "Add"
Select recently added "library" project, click Ok and you're all set.
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.
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.
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 ....
I have two Android Library Projects in Eclipse (yes, "Is library" is selected in both of them).
One of those is ActionBarSherlock, the other one is ViewPagerIndicator
Now, ViewPagerIndicator must include ActionBarSherlock as a library dependence, so I add it under the "Android" settings of the project. Problem is, in the moment I add the library dependence, if I go to Java Build Path of the same project I can see that the dependence .jar of the added library is required but not present (of course, as it is a library project, no jars are created!).
What can be the problem? Furthermore, I have to add both libraries as dependences to an Android application, which presents the same issue.
Are you using ADT14? If so, you probably need to migrate the library projects to the new structure. Right click the library project and select 'Fix project properties' from the Android tools menu.