java - NoSuchMethodException in Gson JsonArray -
so have stumbled on error, whenever seek remove element jsonarray object, nosuchmethodexception. after looking @ solid day, cannot find reason it. method exists in compiled .class file in .jar file included in project. , i'm @ loss now. certainly problem between chair , keyboard, don't see it
edit: after compiling project don't error, has how eclipse managing dependencies, because 1 project utilize gson-2.2.4
i'm using gson 2.3 jar included via maven , downloaded jar file itself.
example piece of code error thrown:
else if (current.isjsonobject() && hasbucket(current)) { jsonelement buckets = current.getasjsonobject().get(buckets); jsonelement next = null; if (buckets.isjsonarray() && buckets.getasjsonarray().size()>0) { jsonarray arr = buckets.getasjsonarray(); arr.remove(0); //<--- exception thrown here } else if (buckets.isjsonobject()) { set<entry<string,jsonelement>> entryset = buckets.getasjsonobject().entryset(); (entry<string, jsonelement> entry : entryset) { next = entry.getvalue(); buckets.getasjsonobject().remove(entry.getkey()); break; } } }
when compile project using maven can see maven using gson 2.3
[info] expanding: /users/####/.m2/repository/com/google/code/gson/gson/2.3/gson-2.3.jar /users/####/documents/workspace/proj_name/target/assembly/work/gson-2.3.jaroutput of javap ~/downloads/gson-2.3/com/google/gson/jsonarray.class
jar file in classpath of java project
there wrong build setup.
jsonarray.remove(int)
introduced in version 2.3 of gson. happening compiling against right version (2.3), version getting packaged in apk not right version.
java gson
No comments:
Post a Comment