============ Problem Description ============
{"Weatherinfo": {"City": "Beijing", "Cityid": "101010100", "Temp1": "2", "Temp2": "All", "weather": "Small to moderate Rain", "IMG1": " D21.gif "," Img2 ":" N7.gif "," Ptime ":" The " .
This is the JSON string that I need to parse out.
Prompt me after running:
Exception in thread "main" Java.lang.noclassdeffounderror:org/json/jsonobject
At Com.test.TestWeather.main (testweather.java:42)
caused By:java.lang.ClassNotFoundException:org.json.JSONObject
This class could not be found.
But I see these JSON-required classes under the Android.jar package.
I tried to import the required package separately, and then I can parse it correctly, but an error occurred when the Android project compiled to generate the APK file.
The prompt package is conflicting. (These packages are visible in the Android.jar.) So there is an error compiling the package.
Ask the great God to help ~~~~~~~~~~
Appreciate it, ~~~~~~.
============ Solution 1============
Has your project been confused and compiled? So that some of the packets that should not be confused are also confused, resulting in the inability to find a method.
============ Solution 2============
Reference 4 floor crazy1235 's reply:
Quote: Quote 3 floor lilidejing reply:
It is recommended to parse JSON with Gson, which is convenient
Do I need to introduce a jar package?
Need, import Gson.jar package on line, Google offers the
============ Solution 3============
Hello, in the Android project, the Java class file cannot be run directly.
You need to use the simulator debug, I've tried it, and Android comes with Jsonobject to parse this string of JSON strings.
The JSON class parsing error that comes with Android is called!!!