adb devices is not recognised as a known command - android

I am trying to set-up a command in Android studio that would allow me to see the current active devices like in this tutorial (1:39:41):
I have opened the environment settings and created the variable adb devices like it was explained in the tutorial
However, when I run it in Android Studio Terminal, the command is not recognised:
What did I do wrong?

The problem is with your naming. Try remove the white space and it will work.
Cause you type adb with argument devices.
Try change your variable to adb
then type
$ adb devices
and it will work

Related

Can we override adb environment variables from terminal?

ADB has following environment variables in their docs.
What is the purpose of providing them in docs. Can we override their default values from terminal ? If so how?
environment variables:
$ADB_TRACE
comma-separated list of debug info to log:
all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp
$ADB_VENDOR_KEYS colon-separated list of keys (files or directories)
$ANDROID_SERIAL serial number to connect to (see -s)
$ANDROID_LOG_TAGS tags to be used by logcat (see logcat --help)
$ADB_LOCAL_TRANSPORT_MAX_PORT max emulator scan port (default 5585, 16 emus)
$ADB_MDNS_AUTO_CONNECT comma-separated list of mdns services to allow auto-connect (default adb-tls-connect)
I am trying to set as shown in docs
I have tried the same on windows PowerShell and macOS terminal without any effect.
for widows powershell I tried
set ANDROID_VERBOSE=radio;adb logcat
for macos terminal I tried
export ANDROID_VERBOSE=radio;adb logcat
But I don't find any difference in output
The purpose of listing them in the documentation is simply to tell people who need to use them that they exist. I don't know Powershell, but the correct macOS syntax is:
export ANDROID_VERBOSE=radio
adb logcat
or:
ANDROID_VERBOSE=radio adb logcat
You can use either, according to your taste.

See app background processes in Android Studio

Maybe I'm just missing it but is there a way to view WHAT is running in the background on-device in android studio?
I'm getting a battery usage alert on my phone (galaxy s8 - OS v8.0), indicating my app is doing something in the background and I'd like to see what it is.
Thank you
Yea, via the terminal function. This is one of options at the bottom of the Android studio.
You need to run ADB to connect to the device. Once connected you can use Unix command lines to see the processes running.
From google dev : https://developer.android.com/studio/command-line/adb
Also, the command I use to connect an emulator to run unix commands is:
adb -s <DEVICE> shell
Normally the ADB is stored :
USER\AppData\Local\Android\Sdk\platform-tools
and then once connected you can use the following to see the running processes :
https://www.howtogeek.com/107217/how-to-manage-processes-from-the-linux-terminal-10-commands-you-need-to-know/
Hope this helps.

Adb copy from device

I am trying to copy a file from my device to my desktop using the following adb command:
adb shell run-as peachss.test.inspect pull /data/data/peachss.test.inspect/files/Inspection.2.xml %USERPROFILE%\Desktop\
But it just say that Package 'peachss.test.inspect' is Unknown, but I can see that it is installed on the device
Edit 1:
Forgot to mention, I am using the S4-Mini with Android 4 or 4.4
Its a recognized Android bug.
More info here and here
The issue is related to the use of "run-as", not "pull", is it totally needed for what you want to achieve?
Hope this help.s

Cannot run Android ADB command

I am using Android Studio v0.8.14 to create a an Android Wearable app. Since I am new I am following the instructions from the android site: https://developer.android.com/training/wearables/apps/bt-debugging.html#SetupSession
I was able to pair the wearable (Moto 360) with my handled device (Samsung Galaxy S4. Kitkat OS v4.4.2). As per the instructions provided the next goal is to set the debugging session. Here I am trying to run the adb commands as shown:
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
But as soon as I the first command my Android Studio gives me the following errors:
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/forward'
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/tcp'
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/localabstract:/adb-hub'
Can someone please explain me what is am I doing wrong here?
Thanks
Raj
I use this solution in my mac ... just run the command:
export PATH=/Applications/Android\ Studio.app/sdk/tools:/Applications/Android\ Studio.app/sdk/platform-tools:$PATH
It's necessary to run this command every time you open a new terminal. Save this in your path to set permanently..

Getting Android SDK version of a device from command line

I'm planning to build an automated system for deploying an Android build to various devices, in order to make development for multiple platforms a bit more comfortable. Is there a way to get the sdk version of a connected device through android shell or adb?
There will be a computer to which several test devices is connected, and I was planning to write a script which will fetch the correct build for each of those from a build-server, install the different apks on their respective devices, launch them and collect log info, to be made available through some other program whose specifications are beside the point.
The point is that I need to know the sdk version each device is running to install the correct apk, and I was hoping I could get this through adb, but I can't seem to find a way to access it short of building a tiny app, compatible with all versions, whose sole purpose would be to output android.os.Build.VERSION.SDK or similar somewhere my script could read it.
you can use this command:
adb shell grep ro.build.version.sdk= system/build.prop
It will output something like this:
ro.build.version.sdk=10
adb shell getprop ro.build.version.sdk
Note #Tim: this works even on phones without grep support on all host OS :-). (i.e. on old phones where toolbox does not support grep you you need to have busybox on your phone).
I also discovered a way to get the exact version of Android e.g. 4.2.2 based on the following web article http://xayon.net/looking-for-android-version-with-adb/ You need to be using a unix-like operating system - Linux and Mac OSX are fine, and windows users can use cygwin or equivalent.
At a command line:
echo version=$(adb shell getprop |awk -F":" '/build.version.release/ { print $2 }')|tr -d '[]'
Here is the result for my Nexus 4:
version= 4.2.2
I think you can by accessing the device with adb shell - change directories to position you at system and do a cat of build.prop. Here you will find for instance, ro.build.description=google_sdk-eng 2.2, ro.build.version.release=2.2 etc

Categories

Resources