Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install APK in Work Profile via ADB in Android

Let's say we have a Work Profile (Android For Work) enabled in Android device. Does anyone know how to install an APK via ADB in Work Profile rather than personal profile.

I have seen the ADB documentation and there's a way to get the User ID but using the same ID I am unable to install an APK.

To get ID : adb shell pm list users Install command : adb install -r --user 12 app_name.apk

Error message :

Performing Streamed Install
adb: failed to install app-prodDebug.apk: Security exception: Shell does not have permission to access user 12
 com.android.server.am.ActivityManagerService.handleIncomingUser:22541 android.app.ActivityManager.handleIncomingUser:3989 com.android.server.pm.PackageManagerShellCommand.translateUserId:2434

java.lang.SecurityException: Shell does not have permission to access user 12
 com.android.server.am.ActivityManagerService.handleIncomingUser:22541 android.app.ActivityManager.handleIncomingUser:3989 com.android.server.pm.PackageManagerShellComma

Any way to get around this ? My use case here is to replace an App with debug option enabled so that I can troubleshoot any issue that is happening with that specific app which is installed in work profile.

like image 296
Sumit Sahoo Avatar asked Jul 09 '19 11:07

Sumit Sahoo


People also ask

Can I install Android app in work profile?

You can install these apps from the Google Play Store app in your work profile. On your device, open the Google Play Store app that has a briefcase badge. Browse for the app that you want to install. On the app page, tap Install and follow the installation procedure.

Can you install APK from ADB?

ADB (Android Debugging Bridge) can be used to execute commands on your VR device. It's mostly used to install applications (APK files) from a Windows PC or Mac with a device connected with USB.

How do I install an APK on my company phone?

Tap on the Security option. Scroll down until you see Unknown sources and check the box. Open your file browser and navigate to your download folder where the APK is. Tap the APK and follow the instructions to install the app.


1 Answers

adb push android.apk /data/local/tmp
adb shell pm install --user 12 /data/local/tmp/android.apk
like image 89
jtmcdole Avatar answered Oct 08 '22 03:10

jtmcdole