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
Related
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
I'm trying to debug an android application that a user has reported a particular problem with. I have created a virtual device but when it comes to the ABI version I'm lost as how to find out the version the mobile is using (if the mobile even uses this!).
(it doesn't help that I don't really know what this means / is used for)
Is there a way to find if the devices is using (armabi-v7a, x86, x86_64, x86(googleAPIs).
Any help is appreciated.
As stated in Determining Supported Processor Types (ABIs) for an Android Device:
Pre-Lollipop: From terminal type adb shell getprop ro.product.cpu.abi
Lollipop and higher: From terminal type adb shell getprop ro.product.cpu.abilist
I have a course project that involves setting up a device driver on Android. I have previously worked with device drivers in the Linux kernel and we used two commands to initialize the device and make a node: insmod and mknod
Now when I launched the emulator shell using adb shell, I was able to use insmod but mknod did not work. I have tried to find alternatives but was not lucky.
From what I know, mknod in the Linux kernel lists the device under the /dev directory and allows user programs to read/write to it by using its file ops.
So what is its alternative for Android?
Perhaps, the android device you're using don't have mknod command. It need to be supported from rootfs, usually Android rootfs are built using busybox. Most probably, mknod was dropped from busybox config. Possible option could be, use custom Android image where you've mknod installed.
I have next situation:
I got 2 version of adb and 2 versions of adbd on 2 different devices.
How can i use both versions of adb from my workstation for these 2 devices.
I mean:
1 adb for 1 device.
2 adb for 2 device.
Now i have following situation:
Every time when i run another adb, previous adb server kills and new one starts.
How can I workaround it?
I think you are asking the wrong question. What I think you want is to run two adb commands at once on different phones. Is that correct?
If so what you are looking for is
adb -s DEVICE_SERIAL xxx
where DEVICE_SERIAL is the value shown when you run adb devices and xxx is the command you want to run. Use adb devices for a list of connected devices.
This only requires you to have one version of adb installed, just open up a new terminal and run the command for the different serial numbered device!
If I'm understand the question correctly I believe he's trying to run two different versions of ADB at the same time. If my assumption is correct then here is what you'd want to do.
Lets assume you have adb.1.0.29.exe and adb.1.0.39.exe on the root of the c: drive which were renamed from the adb.exe from the different versions of platform-tools SDK versions they were supplied in.
To run the ADB version contained within adb.1.0.29.exe all you have to do is what the linked articles say BUT be sure to call the proper exe for that version. I used these adb version names as examples. You can name the adb.exe whatever you want.
So you can call adb commands with different versions as follows,
c:\adb.1.0.29.exe -s serial_of_device adb_command
or
c:\adb.1.0.23.exe -s serial_of_device adb_command
Cheers,
-Rob
I want to write some basic Linux commands in my Android app (namely ls, rm, cp, chmod with recursive -R option) but I am not sure whether they are available across different versions of the OS and whether they support "-R" or not. From my experience, cp seems to be added to Jelly Bean 4.2. The rest are all available in earlier versions.
May I ask if there is a source or reference for this? (Nothing seems to be available on the official Android site.)
You can always fire up a avd and in adb shell run ls /system/bin and ls /system/xbin, it will show all the commands present.