Cannot resolve method 'toMap' in 'JSONObject'

1.1k Views Asked by At

I am working off of the stable build for a project I am working on in a group. This build is confirmed to be working.

It appears that the above method is undefined.

I am working off of the following maven dependency:

com.vaadin.external.google:android-json:0.0.20131108.vaadin1

Why is the method shown as not existing on my end?

Apologies for lack of clarity, if any. It is very late where I am.

1

There are 1 best solutions below

0
On

The org.json.JsonObject class from the dependency

        <dependency>
            <groupId>com.vaadin.external.google</groupId>
            <artifactId>android-json</artifactId>
            <version>0.0.20131108.vaadin1</version>
        </dependency>

does not contain a method called toMap. You can confirm this by downloading the -sources.jar from here: https://repo1.maven.org/maven2/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/ . You can unzip the .jar file to find the sources.

If the build works elsewhere, it could be that there's a different version of android-json (or another library with a JSONObject class - there are several) included where the build runs.