首页 > 解决方案 > android studio 无法通过usb调试

问题描述

我尝试通过 USB 调试我的 android 应用程序,

我第一次运行它完美无缺,

但我关闭 android studio 并重新启动,它报告

(我检查了USB 调试选项是否打开)

12/12 23:48:42: Launching 'app' on HUAWEI VTR-AL00.
$ adb shell am start -n "com.example.onhw/com.example.onhw.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.onhw/com.example.onhw.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.onhw/.MainActivity }
Error type 3
Error: Activity class {com.example.onhw/com.example.onhw.MainActivity} does not exist.

Error while Launching activity

但它仍然适用于虚拟设备

谁能给点建议?

我的手机是华为P10

标签: androidandroid-studiohuawei-mobile-services

解决方案


最后我发现是华为的系统导致了问题

因为在调试模式下,即使我卸载了应用程序,它仍然是应用程序的调试签名,但 android 使用签名来判断应用程序是否已安装

因此,当我再次尝试调试此应用程序时,调试签名仍在系统中,因此无法安装

解决方法:

是使用Sdk/platform-tools/ adb.exe中的 adb.exe 并执行adb uninstall com.example.application以完全删除调试签名


推荐阅读