Android Studio 2.3.2 Launching the app under a work profile or another user account on the target device will result in a crash
Asked Answered
G

1

7

I have installed Android Studio 2.3.2 version, my application was running successfully on the emulator as well as mobile device. After making some changes it's not working on a mobile device but it works fine in emulator.

An event log:

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.
Greyso answered 3/6, 2017 at 7:47 Comment(2)
what the changes you made ?Hooked
you can try to disable Instant Run, sometime's it has some problem that has been known.Paperboy
E
17

Use this to configure your project Launching your app in a Work profile > link not working (as of 22 Dec 2021)

The content below was taken from the link above when it was working:

If you run your app with Instant Run and open your app using a Work profile (or other secondary profile), your app will crash because the instrumented DEX files used by Instant Run are accessible only from the primary profile's user space.

If you want to continue using Instant Run, just avoid opening your app with the Work profile and be sure your run configuration does not use the --user user_id flag.

If you need to use your app with the Work profile, we recommend you create a new run configuration that includes the --user user_id flag, specifying the Work profile user ID. You can find the user ID by executing adb shell pm list users from command line. When you use the --user flag, Android Studio disables Instant Run for only that deployment; Instant Run will work again when you switch to a configuration without the --user flag.

To disable Instant Run:

  1. Open the Settings or Preferences dialog.
  2. Navigate to Build, Execution, Deployment > Instant Run.
  3. Uncheck the box next to Enable Instant Run.

UPDATE (22 Dec 2021):
Check the updated link for Work profiles and this code lab.

Ecclesiology answered 3/6, 2017 at 7:57 Comment(3)
Great! Thank you. Switched to secure zone and allowed Permission to my app. It works fine.Greyso
I think the link description "Launching your app in a Work profile" is misleading - it just links the "Build and run your app" article where I can't see anything about work profile. I don't see anything useful for the question on that page...Withdraw
Thanks @TheincredibleJan for letting me know about the expired link (It was added back in 2017). I have added a new link and a codelab from developer.android.com. Please check if it is useful for your problem.Ecclesiology

© 2022 - 2024 — McMap. All rights reserved.