Breakpoints Not Working With A Service In Android
I'm trying to debug my service but I'm unable to since breakpoints do not work. Yes, I have used android.os.Debug.waitForDebugger(), doesn't matter where I use it (before the line,
Solution 1:
In AndroidManifest.xml add the property android:process=":sync"
to the service entry:
<serviceandroid:name=".SyncService"android:exported="true"android:process=":sync" ><intent-filter><actionandroid:name="android.content.SyncAdapter"/></intent-filter><meta-dataandroid:name="android.content.SyncAdapter"android:resource="@xml/syncadapter"/></service>
After that start the application in debug mode and when it's loaded click the "Attach to process" button. In the list you should see 2 processes:
com.yourpackage
com.yourpackage:sync
Select the :sync one and you are in business.
Solution 2:
Have you tried printing log statements in your service to ensure that your service is even running?
Make sure you've declared your service in your manifest, that's a common error with making services.
Post a Comment for "Breakpoints Not Working With A Service In Android"