2017-06-03 12 views
-1

我已安装Android Studio 2.3.2版本,我的应用程序已成功运行在模拟器以及移动设备上设备。进行一些更改后,它在移动设备上无法正常工作,但在模拟器中正常工作。Android Studio 2.3.2在工作配置文件或目标设备上的其他用户帐户下启动应用程序将导致崩溃

事件日志:

12:55 PM Instant Run performed a full build and install since 
        the installation on the device does not match the local build on disk. 
        (Don't show again) 

12:55 PM 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. 
+0

您所做的更改是什么? – mdb

+1

你可以尝试禁用_Instant Run_,有时它有一些已知的问题。 –

回答

3

使用此配置项目Launching your app in a Work profile

如果你有即时运行来运行你的应用程序,并打开使用Work profile(或其他辅助配置文件)您的应用程序,应用程序将会崩溃,因为即时运行使用的仪表化DEX文件只能从主配置文件的用户空间访问。

如果要继续使用即时运行,只需避免使用工作资料打开您的应用程序,并确保您的run configuration不使用--user user_id标志。

如果您需要使用您的应用程序与工作资料,我们建议您创建一个新的run configuration,其中包括--user user_id标志,指定工作资料的用户ID。您可以通过从命令行执行adb shell pm list users来查找用户标识。当您使用--user标志时,Android Studio仅为该部署禁用即时运行;当您切换到没有--user标志的配置时,Instant Run将再次运行。

要禁用即时运行:

  1. 打开设置或首选项对话框。
  2. 导航到构建,执行,部署>即时运行。
  3. 取消选中启用即时运行旁边的复选框。
+0

太棒了!谢谢。切换到安全区域并允许我的应用程序的权限。它工作正常。 –

相关问题