Java can';不要在Android Studio项目中包含JSONParser

Java can';不要在Android Studio项目中包含JSONParser,java,android,json,Java,Android,Json,因此,我尝试使用JSON构建一个项目。如前所述,我将Java文件作为依赖项包含在build.gradle中。导入Json包后,我仍然无法使用JSONParser。在同步我的项目(包括json库之后)时,我收到两个警告: Warning:Dependency org.json:json:20141113 is ignored for debug as it may be conflicting with the internal version provided by Android.

因此,我尝试使用JSON构建一个项目。如前所述,我将Java文件作为依赖项包含在build.gradle中。导入Json包后,我仍然无法使用JSONParser。在同步我的项目(包括json库之后)时,我收到两个警告:

Warning:Dependency org.json:json:20141113 is ignored for debug as it may be conflicting with the internal version provided by Android.
     In case of problem, please repackage with jarjar to change the class packages
Warning:Dependency org.json:json:20141113 is ignored for release as it may be conflicting with the internal version provided by Android.
     In case of problem, please repackage with jarjar to change the class packages

我只是不知道如何处理这些警告。

解决问题的首选方法是将库作为依赖项包含在build.bradle文件中

在dependency部分添加行

compile 'org.json:json:20141113'
重新同步gradle文件,库将从maven存储库中获取


希望这能解决您的问题。

您确定要导入库吗?看起来您的项目已经有org.json库了。您是否尝试在不导入的情况下使用它?这是一个警告,而不是错误。