Wednesday, 14 August 2013

jsoup not working on android

jsoup not working on android

I have a problem with jsoup on android. I have seen the other posts and
tried solutions that were suggested there ( re-adding the jars, calling
android fix tool, etc.)
I have added the jsoup jar to my android project (using build path), and
added the required internet permission to my manifest.
<uses-permission android:name="android.permission.INTERNET" />
but when I am trying to run my application I am getting Could not find
method org.jsoup.Jsoup.connect, referenced from method
com.example.test.MainActivity.onCreate
I have tried to use the android fix tool but it did not solve the problem.
All I have is a main activity and I am trying to call
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
attached is part of my code import org.jsoup.Jsoup; import
org.jsoup.nodes.Document;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

No comments:

Post a Comment