Android Studio:在设备上调试应用程序 [英] Android studio: debug application on device
问题描述
我在 Android Studio 调试时遇到困难.尝试在调试模式下启动应用程序后,设备显示带有等待调试器"标题的警报,该标题永远不会消失.此外,我的清单文件中有 android:debuggable="true"
并且看起来设备连接正确,因为我可以简单地运行我的应用程序而没有任何问题.我做错了什么?
I have difficulties with with debugging at Android Studio. After trying to launch application in debug mode device show alert with "Waiting For Debugger" title that never disappear. Also I have android:debuggable="true"
in my manifest file and seems like device connected correctly, because I can simply run my application without any problem. What I'm doing wrong?
推荐答案
删除 android:debuggable="true"
,因为当您在 Android Studio 中运行/调试应用程序时,会使用调试证书进行签名因此该设置不是强制性的.
Remove android:debuggable="true"
, because when you run/debug an application in Android Studio is signed with a debug certificate so that setting is not mandatory.
然后从控制台检查设备是否与 adb devices
正确连接.您应该会看到它已列出.
Then check from console if the device is correctly attached with an adb devices
. You should see it listed.
那就这样试试:
1 - 关闭 Android Studio 和您打开的任何其他 IDE(也许您还运行 Eclipse?)和模拟器实例;
1 - close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;
2 - 从 PC 上拔下 USB 线;
2 - remove USB cable from PC;
3 - 从控制台运行 adb kill-server
;
3 - run adb kill-server
from console;
4 - 打开 Android Studio;
4 - open Android Studio;
5 - 点击运行/调试;
5 - click on run/debug;
6 - when the window to select the device appears, attach your device to USB and USB to your computer;
6 - when the window to select the device appears, attach your device to USB and USB to your computer;
这篇关于Android Studio:在设备上调试应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!