cannot resolve symbol jsonobject in intellij

Viewed 3952

Cannot resolve image:

I am getting the error cannot resolve symbol jsonobject in intellij, shown in the attached image:Cannot resolve image, when I press Alt + Enter it does not give me the option to import class.

import org.json.JSONObject;
2 Answers

Please add this in your pom.xml file

<!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
</dependency>

Are you developing Java project through maven. If so approach shared by Alexandros Kourtis should work. If you are not using Maven, download the org.json library and reference it in the project.

Related