How to debug signed Android app from Eclipse?

为君一笑 提交于 2019-12-18 02:16:26

问题


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 ..

  1. 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.
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!