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?

Answers


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.


Need Your Help

strict aliasing and memory alignment

c++ c casting type-punning

I have performance critical code and there is a huge function that allocates like 40 arrays of different size on the stack at the beginning of the function. Most of these arrays have to have certain

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.