[英]Android: Adding external library to project not working
I am trying to add Jsoup library to my project, but I am getting an error in the program saying "Cannot resolve symbol 'Jsoup'". 我试图将Jsoup库添加到我的项目中,但是程序中出现错误提示“无法解析符号'Jsoup'”。 Below is what I have done, but not working.
以下是我已经完成的工作,但无法正常工作。
1)From the Jsoup website, I downloaded the core library jsoup-1.10.2.jar 1)我从Jsoup网站下载了核心库jsoup-1.10.2.jar
2)Dragged and dropped the .jar file under libs folder in my project 2)将.jar文件拖放到我项目的libs文件夹下
3)Under build.gradle in dependencies, I added the following line 3)在build.gradle中的依赖项下,我添加了以下行
compile files('libs/jsoup-1.10.2.jar')
4)In MainActivity.java file, I tried to add the following line 4)在MainActivity.java文件中,我尝试添加以下行
String url = "http://example.com";
try {
Document document = Jsoup.connect(url).get();
//more code here
}
Then, Jsoup turns red and says "Cannot resolve symbol 'Jsoup'". 然后,Jsoup变成红色,并说“无法解析符号'Jsoup'”。 Can anyone tell me what I am doing wrong?
谁能告诉我我在做什么错? I visited many websites and watched a few tutorial videos and I followed them.
我访问了许多网站,并观看了一些教程视频,然后我对其进行了跟踪。 But I am getting this error.
但我收到此错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.