ADB rejected shell command (ls -l /data) - android

I keep getting
ADB rejected shell command (ls -l /data):
and the command prompt when running adb shell tells me error: device not found although the emulator is open.
What I am doing wrong?

I assume you run adb from the command-line. Just do a adb kill-server and a adb start-server. After that your device(s) should be visible.

Related

Android skip chrome welcome screen using adb

I am trying to skip the chrome welcome screen when running tests. The problem is other solutions that I have found like this one don't seem to work anymore.
Commands used:
$ adb shell pm clear com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
The solution for me was actually a combination of the question and this answer. The solution can also be found in another question/answer, though it's not entirely clear.
The following should work:
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
Some notes:
In the Chromium project documentation, it's mentioned that for the command line file to be used, the user should
"Enable command line on non-rooted devices" in chrome://flags
Setting Chrome as the debug application replaces this requirement.
In older device versions, the command line file was expected in /data/local. This folder is no longer writable from adb shell in non-rooted devices, so /data/local/tmp should be used instead. This is documented in this bug
In the ChromeSwitches.java current source code, only --disable-fre still exists. The other flags might be required in older Chrome versions, but I didn't verify.
What is your OS version? It is working on Android 10. You can try the below commands:
$ adb shell pm clear com.android.chrome
$ adb shell am set-debug-app --persistent com.android.chrome
$ adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main

Unistall app from shell using ADB

I've connected the smarthpone (rooted) to the PC (Linux) with ADB.
Eveything works fine excepts the fact that I can't unistall apps from shell. I've tried :
adb unistall com.mirsoft.passwordmemory
adb unistall -k com.mirsoft.passwordmemory
And I get the help message as return.
I've also tried:
adb shell pm unistall com.mirsoft.passwordmemory
adb shell pm unistall -k com.mirsoft.passwordmemory
Getting as return
Error: unknown command 'unistall'
followed by the help message.
Other commands works fine.
Am I doing something wrong?
uninstall has an n after the i. Use adb uninstall com.mirsoft.passwordmemory.
You can also try to uninstall with the rm command:
adb shell rm com.mirsoft.passwordmemory
Don't​ forget typically the su command to grant the super user permissions.

BlueStack Android Emulator device not found after running adb root command

I installed bluestacks version 0.10.0 on my PC.
When i run adb shell this command work fine,
But when i run adb root command and then run adb shell command it give error:device not found.
If i run adb kill-server and then adb shell it work fine.
Any Help?

Error using command "adb install" or "adb push" :device offline

I'm using the AVD,I can use command "ls" to see files ,"adb remount" and it shows remount succeeded,but when using "adb push" , error:"device offline",and "Invalid APK file: 1.apk" when using command "adb install"
Here is the cmd output
D:\android-sdk\platform-tools>adb remount
remount succeeded
D:\android-sdk\platform-tools>adb shell
root#generic_x86_64:/ # adb install 1.apk
adb install 1.apk
Invalid APK file: 1.apk
255|root#generic_x86_64:/ # adb push 1.apk /sdcard
adb push 1.apk /sdcard
error: device offline
1|root#generic_x86_64:/ #
1|root#generic_x86_64:/ # ls
ls
acct
cache
charger
config
d
data
You need to execute "adb push" and "adb install" from your Windows command prompt, not inside the adb shell - the adb shell runs directly on your phone (emulator) and does not know about Windows.

How to check Android OS version of bluestacks Emulator

I searched a lot for this in Google, but no hope, how to check the OS version of Bluestacks emulator in Windows? There is a video in YouTube for checking bluestack version, but not the Android version used in it.
I went to settings – > Advanced settings, but there was no tab corresponding to About tab which is found in an Android emulator like in the case of Genymotion emulator.
There is an easier way of getting to know the android version without having to install any application.
There are some scripts (php/js) that can detect your android version while visiting websites:
Try; http://demo.mobiledetect.net/ Or;
http://detectmobilebrowsers.com/
Install Terminal Emulator from Play Store, open the application and type:
getprop ro.build.version.release
you will get something like: 4.4.4 for KitKat.
or
getprop ro.build.version.sdk for getting the sdk version which will return 19
Open a browser in Bluestacks and go to http://demo.mobiledetect.net
I have tested this on multiple devices of which the Android version is known, and it is accurate.
Currently responds to Bluestacks as v4.4.2 (Kitkat)
Without any installation, you could use your adb commands.
For example, for your main emulator
adb -s emulator-5554 shell getprop ro.build.version.release
adb -s emulator-5554 shell getprop ro.build.version.sdk
For your multi emulators add up by 10,
adb -s emulator-5564 shell getprop ro.build.version.release
adb -s emulator-5564 shell getprop ro.build.version.sdk
adb -s emulator-5574 shell getprop ro.build.version.release
adb -s emulator-5574 shell getprop ro.build.version.sdk
//... so on
You could also do the shell commands by their local ip,
adb -s 127.0.0.1:5555 shell getprop ro.build.version.release
adb -s 127.0.0.1:5555 shell getprop ro.build.version.sdk
adb -s 127.0.0.1:5565 shell getprop ro.build.version.release
adb -s 127.0.0.1:5565 shell getprop ro.build.version.sdk
adb -s 127.0.0.1:5575 shell getprop ro.build.version.release
adb -s 127.0.0.1:5575 shell getprop ro.build.version.sdk
//... so on
just use Droid Info .. which gives you alot of Information quite easely.

Categories

Resources