AbstractThreadedSyncAdapter doesn't fire right away - android

I've been wondering why the AbstractThreadedSyncAdapter doesn't perform Sync once i run the app but instead it waits like 5-10 mins then it starts to download the data using an API request and fills my tables ,which causes this error :
02-03 05:03:34.954 6061-6061/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.moviesapp.app, PID: 6061
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.android.moviesapp.app/com.example.android.moviesapp.app.MainActivity}:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.example.android.moviesapp.app.DetailFragment.ReadTrailersDetailsFromDB(DetailFragment.java:70)
at com.example.android.moviesapp.app.DetailFragment.onCreateView(DetailFragment.java:114)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
at android.app.ActivityThread.access$800(ActivityThread.java:135) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5001) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
at dalvik.system.NativeStart.main(Native Method)

The whole point of the Android SyncManager is that you let it decide when it wants to do a sync. This is for battery efficiency so that the system has the flexibility to batch sync operations from different apps together. Doing so means that the system can turn off the power hungry radio for longer periods of time when all apps have synced.
So, if you use the Android SyncManager (by implementing the SyncAdapter pattern) then you must expect it to call SyncAdapter.onPerformSync() at times that you cannot control.
From what I understand, your Activity crashes because it is reading empty tables? And you expected the tables to have been filled by your SyncAdapter already?
There is no way around it, you must make your Activities so that they can deal with empty tables. You will have to put in an extra check for that.
Note that you can trigger an immediate sync with this:
/**
* Starts a manual sync operation, i.e. independent of the automatic sync settings.
*
* #param context System's service locator
* #param account The account to sync
* #param expedited Make this sync a priority system wide
*/
public static void requestSync(Context context, Account account, boolean expedited) {
Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, expedited);
ContentResolver.requestSync(account, Contract.AUTHORITY, extras);
}
You provide the Account that you want to sync and set expedited to true to make it so that the Android SyncManager will sync your account before any other apps. Because this sync request is set to 'manual' it means the SyncManager will not wait for a convenient time, it will just turn on the radio and start syncing all apps, your's first.
But even if you do a requestSync, you should expect that the internet is slow and the results will take some time from milliseconds to seconds or even minutes before they are written to your database by your SyncAdapter. In the meantime your Activity has already started up and is reading empty tables...
So make sure you Activities do not crash on empty tables.

Related

Error: Only one Looper may be created per thread with stacktrace that has no "Caused by:"

I'm using code from Extending the Service class to handle messaging in two Services and in another class (that's not a Service).
Below is the code that initializes and gets the suspicious objects (one thread each in onCreate() in the Services, and 2 threads in a static method in the other class). Nowhere is thread.run() explicitly called (as it shouldn't be, but I know that I can make the crash happen by calling it after calling thread.start() but not by calling thread.start() twice). While this code is taken from the Android documentation, I've only altered some of the variable names in my implementation. The same is true of the message-handling code that relies on this.
HandlerThread thread = new HandlerThread("ServiceStartArguments",
Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
// Get the HandlerThread's Looper and use it for our Handler
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
Here's the stacktrace. Unfortunately, there's nothing indicating which implementation in my code is the offender, and I'm not able to reproduce the crash.
Fatal Exception: java.lang.RuntimeException: Only one Looper may be created per thread
at android.os.Looper.prepare(Looper.java:89)
at android.os.Looper.prepare(Looper.java:84)
at android.os.HandlerThread.run(HandlerThread.java:54)
06-15 06:23:18.599 27561-29056/? E/BluetoothBoundService﹕ Interrupted
read:
java.lang.InterruptedException
at java.lang.Thread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:371)
at java.lang.Thread.sleep(Thread.java:313)
at services.BluetoothBoundService.receiveDataFromBT
(BluetoothBoundService.java:1442)
at
services.BluetoothBoundService.access$2700(BluetoothBoundService.java:147)
at services.BluetoothBoundService$9.run(BluetoothBoundService.java:1173)
at java.lang.Thread.run(Thread.java:761)
06-15 06:23:18.898 28954-28975/? E/BluetoothRemoteDevices﹕
state12newState1
06-15 06:23:23.469 27561-27570/? E/System﹕ Uncaught exception thrown by
finalizer
06-15 06:23:23.470 27561-27570/? E/System﹕ java.io.IOException: socket
not created
at android.net.LocalSocketImpl.shutdownInput(LocalSocketImpl.java:404)
at android.net.LocalSocket.shutdownInput(LocalSocket.java:207)
at android.bluetooth.BluetoothSocket.close(BluetoothSocket.java:575)
at android.bluetooth.BluetoothSocket.finalize(BluetoothSocket.java:273)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
06-15 06:23:24.112 15861-15861/? E/SearchServiceStarter﹕ Task 174 failed
or timed out. Client 69758913221593243 disconnecting from SearchService!
java.util.concurrent.CancellationException: Task was cancelled.
at com.google.common.util.concurrent.d.ct(SourceFile:75)
at com.google.common.util.concurrent.d.get(SourceFile:57)
at com.google.common.util.concurrent.cg.n(SourceFile:2)
at com.google.common.util.concurrent.av.l(SourceFile:50)
at com.google.common.util.concurrent.ax.run(SourceFile:5)
at
com.google.android.apps.gsa.shared.util.concurrent.a.bc.run(SourceFile:2)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android....ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
06-15 06:23:24.144 15861-15861/? E/WorkerRegistryImpl﹕ getWorker() is
called after WorkerRegistry disposal.
06-15 06:23:24.153 15861-15861/? E/WorkerRegistryImpl﹕ getWorker() is
called after WorkerRegistry disposal.
06-15 06:23:34.229 15861-15861/? E/SearchServiceStarter﹕ Task 174 failed
or timed out. Client 69758913221593244 disconnecting from SearchService!
java.util.concurrent.CancellationException: Task was cancelled.
at com.google.common.util.concurrent.d.ct(SourceFile:75)
at com.google.common.util.concurrent.d.get(SourceFile:57)
at com.google.common.util.concurrent.cg.n(SourceFile:2)
at com.google.common.util.concurrent.av.l(SourceFile:50)
at com.google.common.util.concurrent.ax.run(SourceFile:5)
at
com.google.android.apps.gsa.shared.util.concurrent.a.bc.run(SourceFile:2)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zy
It seems that somehow and somewhy Android is calling thread.run() when it shouldn't be, but I don't know how to tell what's triggering that. I've looked at the other questions and answers that propose overriding run() to prevent this from happening (for example https://stackoverflow.com/a/24115631/1493426), but I don't see how to do that by extending HandlerThread in a reasonable way that won't have undesirable, unintended consequences.
For now I'm inclined to leave everyting alone, since the code has been around for at least several months, and this crash has only been seen once, but I'd like to know if there's a safe way to make the code more crash proof without hiding any underlying problems.

Android Service cannot start because of a ClassNotFoundException from a class that doesn't even exist anymore

My activity 'used' the put a custom (serializable) class in the bundle when starting a Service. But couple version back I had remove it (and delete the class) and directly put primitives in the bundle.
And now... my ACRA log is getting completely hammered by this error of a crash in the onStartCommand when on the line the bundle is read.
java.lang.RuntimeException: Unable to start service com.xxx.MyService#db4c909 with Intent { act=ACTION_START flg=0x4 cmp=com.xxx/.MyService (has extras) }: java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = com.xxx.MyBundle)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3045)
at android.app.ActivityThread.access$2200(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1454)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = com.xxx.MyBundle)
at android.os.Parcel.readSerializable(Parcel.java:2491)
at android.os.Parcel.readValue(Parcel.java:2294)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.get(BaseBundle.java:281)
at com.xxx.MyService.onStartCommand(MyService.java:190)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3028)
....
... 14 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.MyBundle" on path: DexPathList[[zip file "/data/app/com.xxx-2/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx-2/lib/arm, /data/app/com.xxx-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
I don't get what I'm getting error knowing that the com.xxx.MyBundle doesn't even exist anymore in the project!
Note that Im seeing this error in my crash logs. I cannot reproduce this locally probably because I have uninstalled and reinstall the app many times and this it probably fixes the problem.
The issue here is that there thousands of people which the app is probably crashing and cannot just tell to everyone "uninstall- reinstall". I'd like to find the cause of this and possibily fix it with a new update without the user having to manually uninstall the app and reinstall..
EDIT
This is the history of event
v1: I was putting a Serializable class in the bundle when starting the service
(I had forgotten to set the serialVersionUID) and I was seeing a lot of serialization error when starting the service like version mismatch when desializing.. typical error when forgetting the serialVersionUID
v2: I have added serialVersionUID=-1 in my Serializable class
(No dice, in the log I was still seeing these serialization is now saying found version={random number} but was -1....
v3: I gave up and deleted com.xx.MyBundle and created a com.xx.MyBundle2
(no Dice.. and this is when I started to see in the log that ClassNotFoundException)
v4: I Delete com.xx.MyBundle2 and instead of putting the serializable class in the bundle I put directly my primitives
So you see.. it is not a question of service running or not.. Even when my users update from v3 to v4 I would have expect this error to be gone but no... I still see the ClassNotFoundExcpetionn in v4
As I guess from your question, you might have started a Service with a previous version of your application which was removed lately along with the classes used. Its causing the ClassNotFoundException.
So, in this specific case, you might consider detecting the application update and on application update you need to check if the Service is running in background which needs to be stopped.
To check for your newer version of application is installed you'll receive a broadcast event called ACTION_MY_PACKAGE_REPLACED and then you stop the running Service.
To check if your desired Service is already running, you might consider having a checker like this.
private boolean isMyServiceRunning(Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
And then call it using
if(isMyServiceRunning(MyService.class))
stopMyService();
Update
I think I've understood your problem correctly and thought of a solution above already. I guess, the Service you started already in your v1 or v2 is running and expecting the bundle of serialized class there. So you need to stop the service and start it again to make it follow the current behaviour which you're expecting.

Sporadic IllegalArgumentException: Unknown URL content://

Very rarely getting:
Fatal Exception: java.lang.IllegalArgumentException: Unknown URL content://com.example.provider/info
at android.content.ContentResolver.insert(ContentResolver.java:1252)
Fatal Exception: java.lang.IllegalArgumentException: Unknown authority com.example.provider
at android.content.ContentResolver.applyBatch(ContentResolver.java:1247)
Emphasis on rarely. Generally work fine without issue, so the authorities is set up fine, but this is showing up every once in a while for no reason. Are there reasons why the ContentResolver may not be able to find a ContentProvider (i.e. if not set up yet)?
I've had the rare IllegalArgumentException with Unknown URIs issue when I was doing ContentResolver operations in the custom Application object.
For example, I was trying to delete items in my content provider in the application onCreate method which would very occasionally crash:
public class CustomApplication extends Application {
#Override
public void onCreate() {
//..
context.getContentResolver().delete(ReminderEntry.getContentURI(), null, null, null, null);
//..
}
}
Which would sometimes render the following crash:
Fatal Exception: java.lang.RuntimeException: Unable to create application com.myapp.CustomApplication: java.lang.IllegalArgumentException: Unknown URL content://com.myapp.db.CustomContentProvider/reminder
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
at android.app.ActivityThread.access$1800(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.IllegalArgumentException: Unknown URL content://com.myapp.db.CustomContentProvider/reminder
at android.content.ContentResolver.delete(ContentResolver.java:1376)
at com.myapp.ReminderEntryDao.delete(Unknown Source)
at com.myapp.CustomApplication.onCreate(Unknown Source)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6428)
at android.app.ActivityThread.access$1800(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I also saw similar behaviour with a BOOT_COMPLETE receiver. I had about 70 reported crashes with this exception (mostly Infinix devices ~43%, hardly any Samsung Devices) of about 200 000 monthly active users.
I moved this into a background scheduled job and haven't seen the crash since. I was only ever able to reproduce this issue once on a Nexus device that I used but never again.
I suspect perhaps sometimes on some versions of Android on some devices the Application/BOOT_COMPLETE Receiver initializes before the ContentProvider is fully initialized and therefore when it tries to access it, it is not properly set up yet.
There are a couple of stackoverflow posts that do state exactly what is created first and how the OS should behave:
Is the Application class guaranteed to be instantiated before a defined boot receiver is called
But like I said, I've seen otherwise and moving operations out of the classes into background schedulers seems to fix the problem (perhaps it is just because it takes a bit longer to get setup). Hopefully my experience will help you.
Edit: I used the evernote job dispatcher and deferred my ContentResolver operations to the job if required. (but I would assume that deferring the content provider operation to any kind of background processing might fix it as it had a bit more time to get setup - these are just my suspicions of course).
class DeleteRemindersJob extends Job {
#NonNull
#Override
protected Result onRunJob(final Params params) {
cursor = getContext().getContentResolver().delete(ReminderEntry.getContentURI(), null, null, null, null);
//..
return Result.SUCCESS;
}
}

Android Wear Watchface and the WakeLock

I'm developing a watchface for Android Wear using the WatchFace API (extending CanvasWatchFaceService).
I've used the code from here to build a ticker that run code every second.
I'm experiencing the following problem. Every now and then the service crashes with this exception. I can't understand where it comes from, if you have any lead I'll post additional code.
01-06 11:22:00.247 12965-12965/com.my.package E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.my.package, PID: 12965
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.PowerManager$WakeLock.acquire()' on a null object reference
at android.support.wearable.watchface.WatchFaceService$Engine.onCommand(WatchFaceService.java:201)
at android.service.wallpaper.WallpaperService$Engine.doCommand(WallpaperService.java:977)
at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1191)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
After this crash the watchface stops working and to make it start again I have to choose another watchface, then reselect mine, so it's a total show stopper!
Props to David for the lead on super. calls - it turns out that was the problem. Specifically, the CanvasWatchFaceService.Engine.onCreate method needs to call through to its ancestor, as such:
private class Engine extends CanvasWatchFaceService.Engine {
#Override
public void onCreate(SurfaceHolder holder) {
super.onCreate(holder);
// your engine initialization code here
}
// other watch face engine code
}
Without the super.onCreate(holder); call, my watch face would crash within minutes; with it, it happily ran overnight.
As an aside, this is something missing from the Android developer documentation; specifically, the Training page for Building a Watch Face Service doesn't include this ancestor call in its code sample.
The code you linked lacks some important parts, that are dotted. I.e. have you defined the update rate?
private static final long INTERACTIVE_UPDATE_RATE_MS = TimeUnit.SECONDS.toMillis(1);
Fully implemented it works well. See AnalogWatchFaceService in code samples: Wearable/Watchface face.

DeadObjectException with com.google.android.gms

I'm getting a frequent crash with the log below. It doesn't reference my application code but I'm guessing it may have something to do with GoogleApiClient connecting/disconnecting. Anyone get anything similar to this? I haven't been able to find anything on here.
java.lang.IllegalStateException: android.os.DeadObjectException
at com.google.android.gms.internal.ao.removeAllListeners(Unknown Source)
at com.google.android.gms.internal.ap.disconnect(Unknown Source)
at com.google.android.gms.common.api.b.n(Unknown Source)
at com.google.android.gms.common.api.b.a(Unknown Source)
at com.google.android.gms.common.api.b$2.onConnectionSuspended(Unknown Source)
at com.google.android.gms.internal.r.y(Unknown Source)
at com.google.android.gms.internal.q$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.DeadObjectException
at android.os.BinderProxy.transact(Native Method)
at com.google.android.gms.internal.an$a$a.a(Unknown Source)
... 15 more
Possibly where it's happening. I added a try/catch to catch the exception
mGApiClientMgr.addTask(mGApiClientMgr.new GoogleApiClientTask() {
#Override
public void run() {
Log.d(LOG_TAG, "Refreshing data set.");
Location location;
try {
location = LocationServices.FusedLocationApi.getLastLocation(getGoogleApiClient());
onLocationChanged(location);
}
catch(IllegalStateException ex) {
// TODO
}
}
});
where addTask does:
private final LinkedBlockingQueue<GoogleApiClientTask> mTaskQueue = new LinkedBlockingQueue
<GoogleApiClientTask>();
mTaskQueue.offer(task);
This seems related to handlers and message passing...Based on below snippet from your stack trace, gms is seeing a DeadObjectException when trying to process a message on the looper. Even though the stack trace shows gms related, it could have be triggered by your code.
at com.google.android.gms.internal.q$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
This exception is seen if the message its trying to access belong to a process that has since exited/killed. Do a code search for all handler sendMessage* message dispatch calls, through out your code. Even this may not catch all instances as some gms calls could result in handler message dispatches.
Also, check if any of your background services, or activities that allocated handler messages, are exiting. Android could be destroying them depending on life cycle states, try overriding onDestroy.
In all your activities/services, any where you make calls to gms api, check the objects you create and pass to gms; If they die, those objects are not valid any more.

Categories

Resources