Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why does my app keep crashing after it shows up on the Emulator? I just started learning about Jsoup parsing and following different tuts, but I can't find solution to this error.

My code is given below:

package com.example.testingjson;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;


public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// process

Document doc;
try {
doc = Jsoup.connect("http://google.com/").get();
String title = doc.title();
System.out.print(title);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}





And this is the Error Message



12-26 19:30:42.043: E/AndroidRuntime(4260): FATAL EXCEPTION: main
12-26 19:30:42.043: E/AndroidRuntime(4260): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
12-26 19:30:42.043: E/AndroidRuntime(4260): at
com.example.testingjson.MainActivity.onCreate(MainActivity.java:22)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.Activity.performCreate(Activity.java:5104)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.os.Handler.dispatchMessage(Handler.java:99)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.os.Looper.loop(Looper.java:137)
12-26 19:30:42.043: E/AndroidRuntime(4260): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-26 19:30:42.043: E/AndroidRuntime(4260): at java.lang.reflect.Method.invokeNative(Native Method)
12-26 19:30:42.043: E/AndroidRuntime(4260): at java.lang.reflect.Method.invoke(Method.java:511)
12-26 19:30:42.043: E/AndroidRuntime(4260): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-26 19:30:42.043: E/AndroidRuntime(4260): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-26 19:30:42.043: E/AndroidRuntime(4260): at dalvik.system.NativeStart.main(Native Method)
Posted

1 solution

The error is saying that the library for org.jsoup.Jsoup is missing.
Check whether jar file is there or not.

If, its there , then it might not be getting packaged into the apk file.
Try checking the dependencies and lib paths.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900