java.lang.IllegalStateException: Not on the main thread 11-05 10:48:56.504: W/System.err(5498): at com.google.j.a.cl.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.maps.api.android.lib6.c.br.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.maps.api.android.lib6.c.dw.a(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.android.gms.maps.internal.l.onTransact(SourceFile:51) 11-05 10:48:56.505: W/System.err(5498): at android.os.Binder.transact(Binder.java:380) 11-05 10:48:56.505: W/System.err(5498): at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.getCameraPosition(Unknown Source) 11-05 10:48:56.505: W/System.err(5498): at com.google.android.gms.maps.GoogleMap.getCameraPosition(Unknown Source) 11-05 10:48:56.505: W/System.err(5498): at com.reddatura.freecharging_beta.MapView$GetNewPins.doInBackground(MapView.java:241) 11-05 10:48:56.505: W/System.err(5498): at com.reddatura.freecharging_beta.MapView$GetNewPins.doInBackground(MapView.java:1) 11-05 10:48:56.505: W/System.err(5498): at android.os.AsyncTask$2.call(AsyncTask.java:288) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 11-05 10:48:56.505: W/System.err(5498): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-05 10:48:56.505: W/System.err(5498): at java.lang.Thread.run(Thread.java:818) thanks Peter for that. SO the problem doesn't seem to be at onPostExecute as I initially thought, but it is the doinbackground, where I want to get the campos variable EDIT3: as Adogeon advised I've put the whole thing in the main loop, but there is this exception, which I was aware, just for the sake why I used asynctask for this...but I am prone to other suggestions 11-05 11:28:06.926: W/System.err(6417): android.os.NetworkOnMainThreadException 11-05 11:28:06.927: W/System.err(6417): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) 11-05 11:28:06.927: W/System.err(6417): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:249) 11-05 11:28:06.927: W/System.err(6417): at libcore.io.IoBridge.recvfrom(IoBridge.java:553) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.Okio$2.read(Okio.java:113) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.RealBufferedSource.indexOf(RealBufferedSource.java:147) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:94)

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by Citrus
, 1 year ago
Not on the main thread 11-05 10:48:56.504: W/System.err(5498): at com.google.j.a.cl.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.maps.api.android.lib6.c.br.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498
java.lang.IllegalStateException: Not on the main thread 11-05 10:48:56.504: W/System.err(5498): at com.google.j.a.cl.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.maps.api.android.lib6.c.br.b(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.maps.api.android.lib6.c.dw.a(Unknown Source) 11-05 10:48:56.504: W/System.err(5498): at com.google.android.gms.maps.internal.l.onTransact(SourceFile:51) 11-05 10:48:56.505: W/System.err(5498): at android.os.Binder.transact(Binder.java:380) 11-05 10:48:56.505: W/System.err(5498): at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.getCameraPosition(Unknown Source) 11-05 10:48:56.505: W/System.err(5498): at com.google.android.gms.maps.GoogleMap.getCameraPosition(Unknown Source) 11-05 10:48:56.505: W/System.err(5498): at com.reddatura.freecharging_beta.MapView$GetNewPins.doInBackground(MapView.java:241) 11-05 10:48:56.505: W/System.err(5498): at com.reddatura.freecharging_beta.MapView$GetNewPins.doInBackground(MapView.java:1) 11-05 10:48:56.505: W/System.err(5498): at android.os.AsyncTask$2.call(AsyncTask.java:288) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 11-05 10:48:56.505: W/System.err(5498): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-05 10:48:56.505: W/System.err(5498): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-05 10:48:56.505: W/System.err(5498): at java.lang.Thread.run(Thread.java:818) thanks Peter for that. SO the problem doesn't seem to be at onPostExecute as I initially thought, but it is the doinbackground, where I want to get the campos variable EDIT3: as Adogeon advised I've put the whole thing in the main loop, but there is this exception, which I was aware, just for the sake why I used asynctask for this...but I am prone to other suggestions 11-05 11:28:06.926: W/System.err(6417): android.os.NetworkOnMainThreadException 11-05 11:28:06.927: W/System.err(6417): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) 11-05 11:28:06.927: W/System.err(6417): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:249) 11-05 11:28:06.927: W/System.err(6417): at libcore.io.IoBridge.recvfrom(IoBridge.java:553) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) 11-05 11:28:06.927: W/System.err(6417): at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.Okio$2.read(Okio.java:113) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.RealBufferedSource.indexOf(RealBufferedSource.java:147) 11-05 11:28:06.927: W/System.err(6417): at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:94)
at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:175)
at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:616)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:379)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:190)
at com.reddatura.serverside.FreechargingAPI.ExecuteGET(FreechargingAPI.java:42)
at com.reddatura.serverside.FreechargingAPI.GetUnitsOnMap(FreechargingAPI.java:100)
at com.reddatura.freecharging_beta.MapView$1.onMapSettled(MapView.java:101)
at com.reddatura.listeners.MapStateListener.settleMap(MapStateListener.java:119)
at com.reddatura.listeners.MapStateListener$4$1.run(MapStateListener.java:78)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 2 years ago
8 times, 1 year ago

Know the solutions? Share your knowledge to help other developers to debug faster.