如何从 Eclipse 调试已签名的 Android 应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10074177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:59:53  来源:igfitidea点击:

How to debug signed Android app from Eclipse?

androideclipsedebuggingddms

提问by l33t

Android 2.2. I need to debug my signedAPK on my Nexus S. How can this be done using Eclipse?

安卓 2.2。我需要在我的 Nexus S 上调试我已签名的APK。如何使用 Eclipse 完成此操作?

I start the app on my phone and then...?

我在手机上启动应用程序,然后……?

回答by Nikolay Elenkov

Set the debuggable=truein 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.

debuggable=true在清单中设置,导出,安装并签署应用程序。通过 USB 连接设备,启用 USB 调试。然后打开 DDMS 透视图,选择设备并附加到您的应用程序的进程(您将看到列出的包名称)。如果您有 root 设备,并且 adb 以 root 身份运行,则您可以连接到任何进程。

回答by UdayaLakmal

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

当设备连接到你的 eclipse 运行机器时,在 manifest 文件中设置 debuggable=true 并在 android 手机中启用调试模式它可以使用 logcat 查看当前运行日志,否则

You can debug your running application using adb tools from the command line

您可以从命令行使用 adb 工具调试正在运行的应用程序

adb logcat- View device log

adb logcat- 查看设备日志

will display the current logcat (debug messages)

将显示当前的 logcat(调试消息)

adb logcat [ <filter-spec> ]

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

用于配置调试工具查看 http://developer.android.com/guide/developing/tools/adb.html

回答by sandalone

In Android Studio stable, you have to add the following 2 lines to applicationin the AndroidManifestfile:

在 Android Studio stable 中,您必须applicationAndroidManifest文件中添加以下两行:

    android:debuggable="true"
    tools:ignore="HardcodedDebugMode"

The first one will enable debugging of signed APK, and the second one will prevent compile-time error.

第一个将启用已签名 APK 的调试,第二个将防止编译时错误。

After this, you can attach to the process via "Attach debugger to Android process" button.

在此之后,您可以通过“将调试器附加到 Android 进程”按钮附加到进程。

回答by Relsell

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.
  1. 您可以在代码中使用 Log.v 或 log.d 或 Log.i(日志记录),并在您的应用程序在您的设备上运行时在 eclipse 的 logcat 视图中获取所有这些日志。
  2. 您可以在设备上从 eclipse 运行(在调试时,按下 eclipse 上的昆虫图标)应用程序,通过在代码中放置断点,您可以调试应用程序。