I'm running a Nexus 7 emulated device (API 18) using the Genymotion 2.0.3 emulator. And I have the google APIs installed and signed into a google account.
How do I add a restricted user profile? There is no Users menu item in the settings.
You can enable it via adb:
$ adb shell setprop fw.max_users 4
To make it work even after reboot you can do next:
$ adb remount
$ adb shell
# echo "fw.max_users=4" >> /system/build.prop
Since Genymotion is a rooted device, an alternate approach would be to use
an app such as "4.2 Multiple User Enabler". This particular app is
available in the Play Store and is also open source:
https://github.com/SferaDev/4.2MultiuserEnabler.
Related
I am using Android Studio 2020.3.1.
I want to launch a adb shell from within Android Studio.
I have the Terminal tab at the very bottom of the IDE.
But I can only open "Local" terminals.
Any ideas where I can launch a "Remote" adb shell?
Within you local terminal, you can easily start an adb shell with the command adb shell
Locate adb if it's not already in your executable paths environment variable. The location largely dependent on the OS you use and where you install the Android SDK. In general it's in the ${ANDROID_SDK}/platform-tools/ directory.
Execute adb devices. This will list the connected adb capable devices. If you are not running any emulators and you only connect your phone then your phone would show up (if not then you may need to treat some permission steps depending on your operating system). Let's say the ID of your device is XYZ.
Execute adb -s XYZ shell and you'll be in a shell on your device.
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.
adb push android.apk /data/local/tmp
adb shell pm install --user 12 /data/local/tmp/android.apk
Above solution from #jtmcodle works fine.
But to findout userid please use below command
adb shell dumpsys user
In my case above command gave following output
UserInfo{11:10100030} serialNo=11
So I ran below command to make it work
adb shell pm install --user 12 /data/local/tmp/android.apk
According Android Developer site, if you install an app via usb with adb command, it will be installed in both profiles:
Android Developer Site
If you manually install an app over a USB cable to a device which has a work profile, the app is installed on both the personal and the work profile. Once you have installed the app, you can test the app under the following conditions:
If the accepted answer (https://stackoverflow.com/a/59148545/1667216) doesn't work, then invoke the following command from your DPC before you run those 2 steps:
devicePolicyManager.clearUserRestriction(componentName,UserManager.DISALLOW_DEBUGGING_FEATURES
where 'componentName' is the ComponentName of the class that extends DeviceAdminReceiver.
I found Kitkat version allow to record screen using adb commands, So i am trying to record video using adb shell command with below command.
Official Reference this
$ adb shell screenrecord/sdcard/video.mp4
i am using HTC Desire 620g , Driver is updated, USB debugging is checked, it's connected to windows system with MTP Mode.
also tried Revoke USB debugging authorisations.
but still cmd shows this strange behavior ..!
How to solve it..?
There is a space between screenrecord and the file path:
adb shell screenrecord /sdcard/recording.mp4
Then to download the file:
adb pull /sdcard/recording.mp4
When I develop android apps, sometimes I need to use device and sometimes emulator, the problem is when both are connected then if I want to uninstall my app from emulator only I had to disconnect the device. There must be a way so that I can specify from which device to uninstall or install the app. I have tried adb -s option like this
adb -s "emulator-5554" uninstsll com.myPackage.myApp
But it always opens the adb help options. May be the command is not correct. Please help.
adb -e uninstall com.myPackage.myApp
will serve your purpose. FYI, option -e is for emulator.
We have a variety of devices for testing purposes, and now that Froyo is being pushed (to the Nexus One so far at least), we have to constantly dismiss upgrade requests. There is no apparent "stop asking me" button.
So, is there any way I can disable OTA OS updates? We want a number of these phones to stay on old OS versions.
Remove SystemUpdater.apk from /system/app. From terminal (with ADB)
adb pull /system/app/SystemUpdater.apk C:/Path/to/your/desktop //Backup the file (just in case)
adb remount //Remount the system partition to read-write
adb shell rm /system/app/SystemUpdater.apk //Remove the apk
Warning - this will permanently disable system updates, until you push SystemUpdater back to /system/app
For XOOM running android 3 honeycomb. You have to remove Upgrader.apk (not SystemUpdater).
adb pull /system/app/Upgrader.apk C:/Path/to/your/desktop //Backup the file (just in case)
adb remount //Remount the system partition to read-write
adb shell rm /system/app/Upgrader.apk //Remove the apk
From ADB with root access:
adb shell pm disable com.google.android.systemupdater
Not need delete apk.
I have a very old Lenovo Yoga 2 1050F tablet, Android 5.0.1(Lollipop). Today year 2020 it made an unexpected OTA firmware download. After downloading a file reboot gives a signature error which may relate to my root and half broken recovery boot app. This is how I disabled a system update
adb devices | adb shell | su | pm disable com.lenovo.ota