简体   繁体   English

如何在设备中调试我的 android 应用程序

[英]How to debug my android application in device

How can I debug my android application in a device, not in the emulator.如何在设备中而不是在模拟器中调试我的 android 应用程序。 because I get a problem in application testing on the device but at the same time in the emulator I can't find any problem.因为我在设备上进行应用程序测试时遇到问题,但同时在模拟器中我找不到任何问题。

If you are using Eclipse, you can use the build in Debugger.如果您使用的是 Eclipse,则可以使用 Debugger 中的构建。 Just remember to set your phone to Debuggable and put this in your Manifest:请记住将您的手机设置为可调试并将其放入您的清单中:

<application 
        android:icon="@drawable/icon" 
        android:label="@string/app_name"
        android:debuggable="true">
        <activity 

This gives you all information you need: 这为您提供了所需的所有信息:

Using Hardware Devices 使用硬件设备

Don't forget to turn the USB debugging setting on your phone ON.不要忘记打开手机上的 USB 调试设置。 Do it here:在这里做:

Settings->Applications->Development->USB degugging

Make sure that's on.确保它打开。

Method-1 If you are developing the app in eclipse then follow these steps:- 1. Go to AndroidManifest.xml -> Application tab -> Debugabble (dropdown) true.方法 1如果您在 eclipse 中开发应用程序,请执行以下步骤:- 1. 转到 AndroidManifest.xml -> 应用程序选项卡 -> Debugabble(下拉菜单)true。 Description - This will enable the debug mode for your application 2. Now identify the code area where you have doubt of an error.描述 - 这将为您的应用程序启用调试模式 2. 现在确定您怀疑有错误的代码区域。 3. Open the activity code window 4. Double click on the leftmost part(left of line number on the code window) of the identified error line of the code area. 3. 打开活动代码窗口 4. 双击代码区已识别错误行的最左侧(代码窗口行号左侧)。 5. Now Click on Run option(upper side of the window) -> Debug Now you have the full description of the above part before the selected line. 5. 现在点击运行选项(窗口的上方)-> 调试 现在您在所选行之前获得了上述部分的完整描述。

Note :- Attach the device with your system before the 5th step You can also select the first line after the onCreate() and with F6 you can enter into next line.注意:- 在第 5 步之前将设备与您的系统连接 您也可以在 onCreate() 之后选择第一行,然后使用 F6 您可以进入下一行。

You can follow - http://developer.android.com/guide/developing/device.html您可以按照 - http://developer.android.com/guide/developing/device.html

Method-2 You can write Toast to print the varible's values on the device screen.方法 2您可以编写 Toast 以在设备屏幕上打印变量的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM