网上看到有jsoup写的例子,就下载下来进行了研究,但是发现不会导入,于是就百度一下,发现了方法:也就是依次点击“File”->“Import”->“General”->“Existing Projects into workspace”,找到待加载的项目目录就行了。
然后项目虽然导入了,但是发现导入的java命名空间都无法识别,java.io和android.widget等都无法识别,于是google了一下,发现是没有设置好的缘故。在这里,只需要在项目上右击,选择“Properties”,切换到“Java Build Path”,切换到“Libraries”标签,然后点击“Add Liberary”,添加一个“JRE System Liberary”即可,然后依照上面的步骤,选择“Android Classpath Container”,但是却发现添加进来后,出现了如下的错误“unable to get system library for the project ”。
这里出现这个问题,是因为没有选中Android版本的原因,切换到Android节点,在Project Build Target fieldset下面选中Android一个Android版本即可。然后测试,一切正常。
但是,遇到了一个新问题,就是项目编译正常,一旦运行,就会报错。按理来说程序一切正常,没有报错的地方呀。报错的文本为:noclassdeffounderror
就着这个问题,我搜索了下,发现了一个解决方法:
- Go to "Properties" of the project.
- Select "Java Build Path"
- Select "Order and Export" Tab
- You should see the selected project's "src" and "gen" paths and dependencies here.
- The order how they listed were first "src" and then "gen" path
- I switch them, so that "gen" folder is build before the "src"
- Click the project, then select "Clean", choose the project to clean it.
- then It worked for me.