サーバーに JSONObject を要求していますが、いくつかの ID のリストが含まれています。これは Android 4.2 では問題なく動作しますが、Android 2.3 では動作しません (デバイスとエミュレータの両方でテスト済みです)。
JSONObject は次のとおりです。
{"IdList":[{"id":"004502"},{"id":"S007901"},{"id":"041501"},{"id":"S139001"}]}
これは 4.2 では問題なく動作しますがNullPointerException
、2.3 では表示されます。
私のLogCatは次のとおりです。
org.json.JSONException: Value Nullpointer of type java.lang.String cannot be converted to JSONObject
06-06 11:23:46.881: W/System.err(1820): at org.json.JSON.typeMismatch(JSON.java:107)
06-06 11:23:46.893: W/System.err(1820): at org.json.JSONObject.<init>(JSONObject.java:158)
06-06 11:23:46.893: W/System.err(1820): at org.json.JSONObject.<init>(JSONObject.java:171)
06-06 11:23:46.893: W/System.err(1820): at my.Site.serverInterface.executeHttpRequest(serverInterface.java:128)
06-06 11:23:46.893: W/System.err(1820): at my.Site.serverInterface.getAtmId(serverInterface.java:54)
06-06 11:23:46.901: W/System.err(1820): at my.Site.TrackLocation$AtmGetter.doInBackground(TrackLocation.java:379)
06-06 11:23:46.901: W/System.err(1820): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-06 11:23:46.901: W/System.err(1820): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-06 11:23:46.901: W/System.err(1820): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-06 11:23:46.901: W/System.err(1820): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-06 11:23:46.901: W/System.err(1820): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-06 11:23:46.901: W/System.err(1820): at java.lang.Thread.run(Thread.java:1019)
06-06 11:23:46.901: I/System.out(1820): null
06-06 11:23:46.912: I/System.out(1820)://e
06-06 11:23:46.912: W/System.err(1820): java.lang.NullPointerException
06-06 11:23:46.912: W/System.err(1820): at my.Site.TrackLocation$AtmGetter.doInBackground(TrackLocation.java:384)
06-06 11:23:46.912: W/System.err(1820): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-06 11:23:46.912: W/System.err(1820): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-06 11:23:46.912: W/System.err(1820): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-06 11:23:46.912: W/System.err(1820): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-06 11:23:46.912: W/System.err(1820): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-06 11:23:46.912: W/System.err(1820): at java.lang.Thread.run(Thread.java:1019)
06-06 11:23:46.921: W/dalvikvm(1820): threadid=10: thread exiting with uncaught exception (group=0xb60c84f0)
06-06 11:23:46.931: E/AndroidRuntime(1820): FATAL EXCEPTION: AsyncTask #3
06-06 11:23:46.931: E/AndroidRuntime(1820): java.lang.RuntimeException: An error occured while executing doInBackground()
06-06 11:23:46.931: E/AndroidRuntime(1820): at android.os.AsyncTask$3.done(AsyncTask.java:200)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.lang.Thread.run(Thread.java:1019)
06-06 11:23:46.931: E/AndroidRuntime(1820): Caused by: java.lang.NullPointerException
06-06 11:23:46.931: E/AndroidRuntime(1820): at my.Site.TrackLocation$AtmGetter.doInBackground(TrackLocation.java:427)
06-06 11:23:46.931: E/AndroidRuntime(1820): at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-06 11:23:46.931: E/AndroidRuntime(1820): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-06 11:23:46.931: E/AndroidRuntime(1820): ... 4 more