How to add a framework to Eclipse? - android

I need Simple xml parser for my project. I read throu it's site but i couldnt find how should i add it to my project to use it properly.
I programming in android using eclipse.
This is the site of Simple.

You have to do the following:
Download jar or zip of the Simple parser here
Copy it into the directory where the libraries of your project is located.
Let Eclipse knowing it by adding the library into the classpath
In order for the jar to be available at runtime, you need to:
Put the jar under your assets folder
Include this copy of the jar in your build path
Go to the export tab on the same popup window
Check the box against the newly added jar
last part is from here

Related

Android SlidingMenu library installation

I am trying to follow this tutorial.
The aim is to integrate the SlidingMenu android library. As per the instructions in the tutorial:
For non-maven project : Copy
library/target/slidingmenu-1.3-SNAPSHOT.jar into the libs directory of
your project.
I don't know how to use Maven and I don't want to introduce another layer of complexity.
So, where can I locate the library/target/slidingmenu-1.3-SNAPSHOT.jar file?
Update
With the exception of the Maven section, I followed the tutorial completely but got the following single error:
slidingmenu cannot be resolved or is not a field
The error is caused by this line of code:
slidingMenu.setMenu(R.layout.slidingmenu);
I'm a beginner but I know that's an issue of a missing resource. What I don't know is if it's related to the Maven issue. How can I fix it?
So without implementing maven, all you need to do is download that library from your link on github (here). It is only 4.4 MB.
On that github page, there should be a button that says "Download ZIP".
Once you save the zip file, open the zip file, and navigate the contents... inside the library folder, you can find the source files of the SlidingMenu solution.
The QUICKEST way to get this into your project is to copy the contents of the libs, res, and src folders into the respective folders in your project.
The SlidingMenu project on github cannot merely be a .jar file, since it contains visual assets as well (ie. items in the /res folder are needed).
Another approach is to create a separate project on your computer named SlidingMenu (create it as a "library" project) and then include this project into your own project as a dependency. The manner in which to do this varies by IDE (Eclipse, IntelliJ, AndroidStudio, etc). Hopefully you're using one of those IDEs.

Can't use a Jar file in Android Project

I'm trying to use an external jar file in my Android project, I follwed this step for including it:
I put the jar file in libs.
I configured the build path and now I can see the jar file in the Referenced Libraries section of the project.
I use the import to bring the class that I need inside the program.
But I always get NoClassDefFoundError. This jar already works with a classic java program.
Make sure that the jar is being built with the app. In eclipse,
right click on project --> build path --> configure build path.
Make sure the library is checked in the Order and Export tab.
Since Android SDK 17 there is not even necessary to manually add the jar files to buildpath, because they are added automatically, as stated here. Then I would suggest to:
remove the library from buildpath
clean the project
make sure the jar file is located in a folder called libs (not lib) located in the root folder of your project
refresh the project
run the project
The solution found was recompile the library with the version 6 of java and using the jar fail obtained

Adding third party jar tools

I finished an app like a month ago which uses the JSoup jar in it. commonsWares pointed out to me that I need to remove the jar file from the build path and create a libs folder for proper usage.
I removed it from the build path and created a folder called libs and placed the jar file in there. Is this correct?
The android project is returning error because it can't see the JSoup library. So how do I do this to ensure its all visible and working well?
A screenshot of what I have done is below:
It sounds like you may not be on the latest ADT.
The latest ADT should just pick up any jar in your library.
Every time you move a jar file's location you need to update the build path. In Eclipse, you should right click on the project, select Build Path then Configure Build Path. Then just select the Libraries tab, and then Add Jar. Find your jar file and select it and you should be good to go.

Android how to export jar with resources?

I create an Android project for build my custom widget, and I want to export it as a jar for other project so that reuse them conveniently, but now a problem is, I can't use resources which is included in my custom widget jar, for example a png picture, it gets a null from the resource Id of class R! How can I sovle it?
Update question:
How can I parse LayerDrawable xml from assets folder in code?
You cannot export self-contained Android Library jar at this time and announced will be available in the future SDK release.
https://developer.android.com/guide/developing/projects/index.html#LibraryProjects
You cannot export the Android Project to Jar with Resources. What you can do is Make First Project as Library and then Add that to another project.
See Documentation Here shows how to Setup a Project as Library and use in another Project
In order to get the app working with my exported library .jar file, I had to copy everything in the resources directory "res" from the library project to the application project. Also had to merge file string.xml as well as merge the ApplicationManfiest.xml files as well. To add the project as a library through eclipse is much simpler.

How to include jar files in android library project

I am trying to use phonegap inside an android library project. The library project compiles just fine but when i try to start an activity that extends DroidGap, i get this error
01-02 10:12:17.575: W/dalvikvm(316): Unable to resolve superclass of Lcom/***/***.
I think this is because the phonegap.jar file is not included in the compiled jar file of the android library project. I have tried using ant to build but it doesn't seem to work.
Edit: I am building a android library that can be used in other android projects. I am using the standard android library project but activities in this lib project that extended DroidGap class in phonegap.jar are crashing with the above error.
I´m afraid that is not possible yet. The result jar file will contain all classes and resources defined in the android library project, but will not include external jar files added to the build path. You will have to add those to your final Android Projects using that library. You can also find similar questions in SO like this one
create one folder 'lib' in your project. put your .jar file in lib folder. select your .jar file right clicked on ,select buid path --->'add to build'. will add your .jar file. now you can use this .jar file classes.
I would suggest not making the 'lib' folder manually.
Instead:
Right click Project --> Properties --
Select Java Build Path
Make sure Libraries is the tab selected at the top
Click Add External JARs
Then find your JAR...
Basically, the same way you may have added the PhoneGap.jar
The ADT (Android Development Tool Eclipse plug-in) has built-in support for the creation and reference of library projects. See the example in section 5 of this tutorial.
Try changing the name of the folder to libs instead of lib.
have you added required permission in manifest file..
see the below links
http://docs.phonegap.com/en/1.4.0/guide_getting-started_android_index.md.html

Categories

Resources