I work with eclipse Version: Indigo Service Release 2 Build id: 20120216-1857. The Android version ist 2.2. I make an app to test a connect and parse a web site like this:
I solved the same problem by following above steps
You don't need the line:
<uses-library android:name = "org.jsoup.Jsoup"/>
in your manifest file. All you need to do to use Jsoup is to ensure it's part of your build path by doing the following:
Then, Jsoup will act like any other library in java. For example in my app I use it like so:
try
{
Document doc = Jsoup.connect( myHtml ).get();
Elements table = doc.select( "table#ctl00_ContentPlaceHolder1_tblPasses" );
// Returns first row of the table which we want
Elements row = table.select( "tr.lightrow" );
Element record_One = row.first();
}
Note - I have not included all my code for it because it's rather long. Anyway, after that you just import the classes as needed, for example in mine I use the following:
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
My solution was
p.s I was using jsoup and sherlock. I didn'y change sherlock library, only my main project.
I encountered this exact problem after a recent update of the ADT component of Android. It looks like Android is ignoring the build path and instead using the ANT defaults.
I solved this by removing my jar file from the build path, creating a folder in the "root" of the app heirarchy (alongside src, gen, etc) called "libs", and putting my .jar there. When you clean / build and re-launch the app, the error should go away.
FYI - this is occurring because the JAR file is not getting packaged into the .apk files - this is why it builds correctly, but isn't available during run-time on your Android device.
see NoClassDefFoundError - Eclipse and Android
You are doing it wrong. You cant use Jsoup functions in the oncreate of Activity. You need to make either Async Task or thread.
This is to prevent doing blocking tasks in you activity.
Here is a nice blog that explain how to do it and provide sample code as well.
Sample Code Click here
There's also the issue that jars have to be in the libs (with an 's') directory and not lib....could this be your problem?