问题
Android 2.2. I need to debug my signed APK on my Nexus S. How can this be done using Eclipse?
I start the app on my phone and then...?
回答1:
Set the debuggable=true in the manifest, export, install and sign the the app. Connect the device via USB, enable USB debugging. Then open the DDMS perspective, select the device and attach to your app's process (you will see the package name listed). If you have a rooted device, you can connect to any process if adb is running as root.
回答2:
When device connect to your eclipse running mechine , set debuggable=true in manifest file and enable debug mode in android phone it can view current running log using logcat, otherwise
You can debug your running application using adb tools from the command line
adb logcat - View device log
will display the current logcat (debug messages)
adb logcat [ <filter-spec> ]
using you can filter only your given debug messages
for configure debug tool view http://developer.android.com/guide/developing/tools/adb.html
回答3:
In Android Studio stable, you have to add the following 2 lines to application in the AndroidManifest file:
android:debuggable="true"
tools:ignore="HardcodedDebugMode"
The first one will enable debugging of signed APK, and the second one will prevent compile-time error.
After this, you can attach to the process via "Attach debugger to Android process" button.
回答4:
You have two ways ..
- You can use Log.v or log.d or Log.i (Logging) in your code and get all those logs in logcat view in eclipse while your application runs on your device.
- You can run (while debugging , pressing that insect icon on eclipse ) the application from eclipse on device, By putting breakpoints in your code you can debug your application.
来源:https://stackoverflow.com/questions/10074177/how-to-debug-signed-android-app-from-eclipse