ITPub博客

首页 > IT职业 > IT图书 > Unable to instantiate activity Comp

Unable to instantiate activity Comp

IT图书 作者:jn_fjd 时间:2021-09-09 09:43:06 0 删除 编辑

错误描述:

今天做了一个关于传感器的demo,任何地方都没有出错,但是运行安装到真机的apk居然老是闪退

报:Unable to instantiate activity ComponentInfo   Didn't find class " " on path: DexPathList 

图片描述

过程:

用百度和谷歌搜了老半天,试了好多说实话对我遇到的错误没有任何意义;又看了一编logcat,同时我发现EventLog里面有句和重要的话 Instant Run detected that you are running on a target device that has a work profile or multiple user accounts.Launching the app under a work profile or another user account on the target device will result in a crash.Learn more about how to run your app under a work profile. 这句话的实际意义就是:正在运行具有工作配置文件或多个用户帐户的目标设备。在工作配置文件或目标设备上的另一个用户帐户下启动应用程序将导致崩溃。了解有关如何在工作配置文件下运行应用程序的更多信息。看到这句话也就明白意思了,也就是说我运行配置有问题,那我就找studio找到安装运行配置进行设置

解决:

Settings>Build Execution Deplayment>Instant Run把对勾点掉保存,然后Clean一下项目运行

图片描述

原文链接:http://www.apkbus.com/blog-784586-78028.html


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3813/viewspace-2811592/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-09-27

  • 博文量
    0
  • 访问量
    443