[android-developers] Re: SyncAdapter exception that I can't seem to trace.

2012-12-19 Thread Brill Pappin
I'm actually not calling any AsyncTasks at all in any part of the 
application *yet* and thats why the error was confusing me.
That exception appears to be inside the Android API and popped up when I 
made the provider multiprocess (via the manifest).

When you have that setting true, you are essentially telling the OS that it 
can create threads as needed for the provider, but the new threads don't 
have a proper environment.
So, my guess its a bug in android, but I never had the time to go and try 
and find out if that is the case or not. I can tell you it was happening in 
ICE but not JB, which makes me think it was eventually fixed.

- Brill

On Tuesday, December 18, 2012 5:25:34 PM UTC-5, Jonathan S wrote:

 I am wondering why you are calling AsyncTask in SyncAdapter or 
 ContentResolver? It is very odd. AsyncTask supposed to do run CPU heavy 
 tasks on background then update it to UI threads.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SyncAdapter exception that I can't seem to trace.

2012-12-18 Thread Brill Pappin
Since posting this, I've narrowed it down to the Provider causing the 
exception, although as yet I can't find any reference to the UI thread.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SyncAdapter exception that I can't seem to trace.

2012-12-18 Thread Brill Pappin
Well it appears that the the provider param android:multiprocess=true was 
causing the problem. changing it to false made the exception and crash go 
away. I don't know yet if this is a fix because I need to run it through 
some tests, but it does make sense in terms of what the exception was 
showing us, and known causes for those exception.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SyncAdapter exception that I can't seem to trace.

2012-12-18 Thread Jonathan S
AsyncTask is calling this error which is Can't create handler inside thread 
that has not called Looper.prepare()

On Tuesday, December 18, 2012 12:43:51 PM UTC-5, Brill Pappin wrote:

 THis is not the first time I've written a sync adapter, but thi is the 
 first time I've seen this problem.
 I can't find were it might be happening and I'm wondering if anyone else 
 has seen this.

 The problem is that it seems to be internal to the SyncAdapter.
 I already know that the likely reason for the Handler exception is a UI 
 call in a non UI thread, but the trouble is that I am not using any UI in 
 the syncadapter (not even a toast). I have heard that its possible for 
 another thread to die and cause a cascade that is not obvious, but it that 
 is happening here, there are no clues I can see.

 So... if anyone can shed some light on this issue, I've love to hear what 
 you have to say.


 12-18 12:26:20.347: E/AndroidRuntime(22903): FATAL EXCEPTION: 
 SyncAdapterThread-1
 12-18 12:26:20.347: E/AndroidRuntime(22903): 
 java.lang.ExceptionInInitializerError
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.content.ContentProvider.attachInfo(ContentProvider.java:929)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.app.ActivityThread.installProvider(ActivityThread.java:4237)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.app.ActivityThread.acquireProvider(ActivityThread.java:4035)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1612)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.content.ContentResolver.acquireProvider(ContentResolver.java:949)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.content.ContentResolver.acquireContentProviderClient(ContentResolver.java:984)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:245)
 12-18 12:26:20.347: E/AndroidRuntime(22903): Caused by: 
 java.lang.RuntimeException: Can't create handler inside thread that has not 
 called Looper.prepare()
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.os.Handler.init(Handler.java:121)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.os.AsyncTask$InternalHandler.init(AsyncTask.java:607)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.os.AsyncTask$InternalHandler.init(AsyncTask.java:607)
 12-18 12:26:20.347: E/AndroidRuntime(22903): at 
 android.os.AsyncTask.clinit(AsyncTask.java:190)
 12-18 12:26:20.347: E/AndroidRuntime(22903): ... 7 more



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SyncAdapter exception that I can't seem to trace.

2012-12-18 Thread Jonathan S
I am wondering why you are calling AsyncTask in SyncAdapter or 
ContentResolver? It is very odd. AsyncTask supposed to do run CPU heavy 
tasks on background then update it to UI threads.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en