android - 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
解决方案
最后我发现是华为的系统导致了问题
因为在调试模式下,即使我卸载了应用程序,它仍然是应用程序的调试签名,但 android 使用签名来判断应用程序是否已安装
因此,当我再次尝试调试此应用程序时,调试签名仍在系统中,因此无法安装
解决方法:
是使用Sdk/platform-tools/ adb.exe中的 adb.exe 并执行adb uninstall com.example.application
以完全删除调试签名
推荐阅读
- java - 初学者的问题:在Java中插入表情符号
- python - 在动态链接库 Anaconda3\Library\bin\mkl_intel_thread.dll 中找不到序数 242
- python - 从gradle进程调用时没有colorama颜色
- c++ - 额外的分配 valgrind
- xml - VB6中的XML粉碎/查找最大属性值
- ios - 使用固定子视图自动调整表格视图单元格
- ruby-on-rails - 表单未向我的模型提交数据。如何在提交时创建数据?
- regex - 使用 RegExp 从 URL 中提取 ID
- c++ - 在 Windows 或 Linux 上运行时函数的行为不同
- django - 在 Django 的 ORM 中使用相同的参数链接 Q() 对象的问题