Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
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 15-Jun-13 2:36am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 575
1 Maciej Los 555
2 Sascha Lefévre 264
3 Suvendu Shekhar Giri 229
4 Richard Deeming 195
0 Sergey Alexandrovich Kryukov 9,693
1 OriginalGriff 9,185
2 Peter Leow 5,112
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,876


Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 16 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100