Cannont resolve symbol JSONObject (Android Studio)

时光总嘲笑我的痴心妄想 提交于 2019-12-12 08:28:50

问题


I have spent two days in this. I can work with other PC, but my Android Studio doesn´t import the library, I took two captures:

As yo can see in the first picture, Android Studio autocompletes my line:

However:

I was reading about JSONObject in Android Developers (here) and Android include this in library. I also have tried to import other libraries from "org", but just works fine two of them:

Them... I was thinking this might be a problem of Android Studio, and I reinstalled the IDE, the error persists.

And I have tried to import the library in the gradle (this is in build.gradle module: app):

I was working with other PC, it works well, but I need to fix this in my computer.

Please, any help will be grateful.


回答1:


I´ll respond to the future, if someone has the same error:

I did this (Thaks to Bigdestroyer):

File -> Invalidate caches/Restart -> Invalidate and Restart 

You can try to delete ~/.gradle/caches directory to force re-download the dependencies.

Now its works perfect. Thanks !!!!



来源:https://stackoverflow.com/questions/29916334/cannont-resolve-symbol-jsonobject-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!