Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:13:38+00:00 2026-06-16T00:13:38+00:00

I noticed one interesting thing with my app ( I use Jsoup inside AsyncTask)

  • 0

I noticed one interesting thing with my app ( I use Jsoup inside AsyncTask)

After that my app crashed.
LogCat is:

 12-15 11:16:43.023: I/dalvikvm(371): Could not find method org.jsoup.Jsoup.connect, referenced from method com.example.myexample.MainActivity$MyTask.doInBackground
12-15 11:16:43.033: W/dalvikvm(371): VFY: unable to resolve static method 3462: Lorg/jsoup/Jsoup;.connect (Ljava/lang/String;)Lorg/jsoup/Connection;
12-15 11:16:43.033: D/dalvikvm(371): VFY: replacing opcode 0x71 at 0x0003
12-15 11:16:43.033: D/dalvikvm(371): VFY: dead code 0x0006-000d in Lcom/example/myexample/MainActivity$MyTask;.doInBackground ([Ljava/lang/String;)Ljava/lang/String;
12-15 11:16:43.113: W/dalvikvm(371): threadid=9: thread exiting with uncaught exception (group=0x40015560)
12-15 11:16:43.133: E/AndroidRuntime(371): FATAL EXCEPTION: AsyncTask #1
12-15 11:16:43.133: E/AndroidRuntime(371): java.lang.RuntimeException: An error occured while executing doInBackground()
12-15 11:16:43.133: E/AndroidRuntime(371):  at android.os.AsyncTask$3.done(AsyncTask.java:200)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
12-15 11:16:43.133: E/AndroidRuntime(371):  at java.lang.Thread.run(Thread.java:1019)

Fatal exception connected with Async! But I don’t understand why
My App:

public class MainActivity extends Activity {
MyTask mt;
  TextView tvInfo;
  String URL="http://en.wikipedia.org/";
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tvInfo = (TextView) findViewById(R.id.tvInfo);
  }

  public void onclick(View v) {
    mt = new MyTask();
    mt.execute(URL);
  }

  class MyTask extends AsyncTask<String, Void, String> {
      Document doc;
      String title=null;
      String what1=null;
    @Override
    protected void onPreExecute() {
      super.onPreExecute();
      tvInfo.setText("Please wait...");
    }

    protected String doInBackground(String... params) {
      // TimeUnit.SECONDS.sleep(2);
       String url=params[0];
       Document doc;

    try {
        doc = Jsoup.connect(url).get();
        String what1=doc.title();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


      return what1;
    }

    protected void onPostExecute(String result) {
      super.onPostExecute(result);
      tvInfo.setText(result);
    }
  }
}

If I change my code (without JSoup) Async works good:

public class MainActivity extends Activity {
MyTask mt;
  TextView tvInfo;
  String URL="http://en.wikipedia.org/";
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tvInfo = (TextView) findViewById(R.id.tvInfo);
  }

  public void onclick(View v) {
    mt = new MyTask();
    mt.execute(URL);
  }

  class MyTask extends AsyncTask<String, Void, String> {
      Document doc;
      String title=null;
    @Override
    protected void onPreExecute() {
      super.onPreExecute();
      tvInfo.setText("Please wait");
    }

    protected String doInBackground(String... params) {
      // TimeUnit.SECONDS.sleep(2);
       String url=params[0];
       //doc = Jsoup.connect(url).get();
       //String title = doc.title();
      // Log.d("AsyncTask doInBackground","URL: " + params[0]);
      return url;
    }

    protected void onPostExecute(String result) {
      super.onPostExecute(result);
      tvInfo.setText(result);
    }
  }
}

In TextView I get a Url of Wiki.
Please, can anyone help me with this fact.
Thank you!

P.S I add permission of internet in Manifest file
P.P.S I use JSoup version 1.7.1 (added as external jar file)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:13:39+00:00Added an answer on June 16, 2026 at 12:13 am

    I did so right click on project->build path-> add external archives

    Please undo that, then create a libs/ directory in your project (as a peer of src/, res/, etc.) if you do not already have one. Then, put the JSoup JAR in the libs/ directory. This will both add it to your build path and include its contents in your APK file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm learning to manipulate the DOM and I noticed one interesting thing: Let's
I found an interesting issue that confused me. I noticed it when I use
I've noticed that when one performs the above action and then copies the result
I am examining a core dump, and noticed that in one frame the 'this'
One thing I have noticed a lot of back and forth on is where
One thing I've noticed with all the XML-RPC examples out there, including the spec
I noticed that there are two sets of Hadoop configuration parameters: one with mapred.*
I noticed that I can't combine --traditional options with the other one letter other
After carefully reading this KB article I noticed an interesting statement there. The article
You must have noticed one link in yahoo.com, msn.com or other popular websites named

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.