Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SampleSyncAdapter Breakpoints Not Working

I'm using Eclipse to learn how the SampleSyncAdapter example works. I can't get my breakpoints to work. I set a breakpoint in multiple locations but none get hit. For example, AuthenticatorActivity.onCreate() never get's called. Anyone know why?

Thanks.

like image 298
Mitch Avatar asked Dec 19 '11 09:12

Mitch


2 Answers

The SyncAdapter thread of execution occurs in a spawned background process, not in the process of your application itself, which is what you have your java debugger attached to.

Simple and ugly way: log() is your friend.

Better way: Start by looking at Debugging a service and find if that needs to be adapted for this case.

like image 153
jcwenger Avatar answered Oct 05 '22 03:10

jcwenger


Actually, a sync adapter runs in the process in which it is configured. The documentation suggests setting android:process=":sync", but that is only a suggestion. For debugging you can always remove this line.

For Android Studio + Gradle, you might consider adding a debug version of the manifest in src/debug/. Turns out that the Gradle plugin is unable to merge in just the android:process attribute so you need to define the service and provider in src/release/AndroidManifest.xml and src/debug/AndroidManifest.xml separately so there is no merge conflict.

like image 25
Eric Woodruff Avatar answered Oct 05 '22 01:10

Eric Woodruff