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.

  • Disable orange outline highlight on focus
  • chemistry formula on Android
  • What's the point of FILL_AND_STROKE?
  • When to use which constructor for ComponentName in Android?
  • Facebook SDK 3.0 - how to force AUTH dialog?
  • How can I set TextColor, TextSize of PagerTitleStrip from code?
  • Related posts:

    How to change colour of the thumb in seekbar?
    Move video file captured by camera using cordova (phonegap) is not refreshing gallery thumbnail
    ScrollView adds large space at the bottom
    Fragments remain after Activity get's killed and recreated
    How to disable rotating to landscape mode?
    Issue scrolling WebView in NestedScrollView Android 2.3 or less
  • Your APK's version code should be higher than 378
  • Activity and Fragment Lifecycles and Orientation Changes
  • The intel x86 emulator accelerator (HAXM installer) revision 6.0.5 is showing not compatible with windows
  • android format edittext to display spaces after every 4 characters
  • Put an object in Handler message
  • Are parameters in strings.xml possible?
  • 5 Solutions collect form web for “SampleSyncAdapter Breakpoints Not Working”

    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:

    android.os.Debug.waitForDebugger();
    

    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

    android:process=":sync"
    

    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:

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.