Home » Android » android – SampleSyncAdapter Breakpoints Not Working

android – SampleSyncAdapter Breakpoints Not Working

Posted by: admin May 14, 2020 Leave a comment


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?


How to&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.


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.


I had this problem and the solution was quite simple. As said before, the SyncAdapter runs on a different thread so you need to point the debugger to this thread.
On Android Studio you add (code below) inside the SyncAdapter class:


When you’re debugging your app the sync adapter service won’t be running automatically, so you have to start it and then target that process.

Attach debugger to Android Process (It’s an icon next to the green bug)

It should work just fine


Following @Eric Woodruff answer I got this idea that I share for those who want a debugging session in Eclipse exclusively dedicated to the sync adapter:
1. Switch to DDMS perspective
2. In the device/emulator process locate :synch (see the picture)
3. Then click on the green bug button ( Debug the selected process: provided it’s source project is present and opened in the workspace )
enter image description here

this works fine for me and give me a more realistic point of view:
enter image description here



As given in other answers works great.

On top of that, if your call to ContentResolver.requestSync(mAccount, AUTHORITY, settingsBundle) has anything wrong with it, your service won’t get called without any errors thrown.
You need to double check that the Authority string is matching in the manifest and xml, and java code. Also the Account object is created correctly with the right account type and added to the AccountManager using:

accountManager.addAccountExplicitly(newAccount, null, null)

(the variable names are named after the official android tutorial here:


After checking several answers, this what worked for me

  1. tag process with :sync in manifest

  2. run in debug mode

  3. place your breakpoint where you want

  4. during Debug press “Attach Debugger to Android process”

Attach Debugger to Android process

  1. Activate the sync once – if your sync adapter is synced with an item (e.g. contacts), you can go to settings/Accounts and backup/Accounts/Your Acount/ Sync acount and press “Sync Now” to activate.

  2. When sync first activated, you will see your packagename:sync at the “Choose process” window. Choose it and press OK

  3. Next time the sync is activated, it will go to your breakpoint