问题描述
我在这花了两天时间.我可以在其他 PC 上工作,但我的 Android Studio 没有导入库,我拍了两张照片:
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:
正如您在第一张图片中看到的,Android Studio 会自动完成我的行:
As yo can see in the first picture, Android Studio autocompletes my line:
然而:
我在 Android Developers 中阅读了 JSONObject(此处)和Android 将其包含在库中.我还尝试从org"导入其他库,但其中两个可以正常工作:
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:
他们...我在想这可能是Android Studio的问题,我重新安装了IDE,错误仍然存在.
Them... I was thinking this might be a problem of Android Studio, and I reinstalled the IDE, the error persists.
我已经尝试在 gradle 中导入库(这是在 build.gradle 模块:app 中):
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.
推荐答案
如果有人有同样的错误,我会回复:
I´ll respond to the future, if someone has the same error:
我做到了(感谢 Bigdestroyer):
I did this (Thaks to Bigdestroyer):
File -> Invalidate caches/Restart -> Invalidate and Restart
您可以尝试删除 ~/.gradle/caches
目录以强制重新下载依赖项.
You can try to delete ~/.gradle/caches
directory to force re-download the dependencies.
现在它的工作完美了.谢谢 !!!!
Now its works perfect. Thanks !!!!
这篇关于无法解析符号 JSONObject (Android Studio)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!