In principle, you have two possibilities, and, as a rule, the first should help you find the cause of the failure without encoding, because logcat should show the error that led to the termination of the service.
1) Using the logcat command
With Log.i("your tag", "output text") , you can intercept these messages using the Android Eclipse plugin or by calling adb logcat from the command line using your Android device and your service.
See also http://developer.android.com/guide/developing/tools/adb.html#logat
2) Write to stdout
Using the System.out.println("...") command, you can configure your device to write stdout to a file:
adb shell stop adb shell setprop log.redirect-stdio true adb shell start
See also http://developer.android.com/guide/developing/tools/adb.html#stdout
Obviously, you need to distribute a large number of debug output messages to your application, mainly at critical points.
Good luck finding the error!
source share