Regarding this post: adb shell auto-complete under Windows 7?
The owner's answer is: "Solved this problem by recompiling adb under cygwin. :)"
Unfortunately I can't send comments asking him how did he recompiled the adb under cygwin.
So my question is: How could I recompile adb under cygwin to get auto-compete working in adb?
EDIT: I realized that actually cygwin is already auto-completing when I type inside android bash, but the text is not being showed. Weird, isn't? E.g:
# ls /data/tem
[TAB]
# ls/data/tem | <<<--- the cursor jumps to here
[ENTER]
It list all files and folders within /data/temp folder.
You can use ADB enhanced Putty
It support auto complete and coloring
you can download it from
ADB Putty
Just start it suing the following command-line:
adb-putty.exe -adb -P 5037 transport-usb
read more at ADB enhanced Putty (replacement for "adb shell" command)
Try PuTTY Tray. Its work for me!
connect to the phone via "adb connect ip:port"
run Putty Tray, select Adb and click "Open"
PS.
You can specify device ID in session settings.
I'm (fortunately) not a Windows user but I guess the problem is not in adb but in your shell that is not letting some keys (i.e. TAB) reach it.
Try this to see if TAB is received by the android shell:
adb shell
# printf '%d\n' "'$(dd bs=1 count=1 2>/dev/null)"
<type TAB+ENTER>
9
If you cannot see 9 (ascii TAB) then your problem is in the Windows shell and you could try cygwin bash to reproduce the test and see the results.
Are you mis-understanding the original post? I think that guy is saying he stopped using the Command Prompt and switched to cygwin.
You can make auto complete work in the Windows command prompt as well. Just run cmd /f instead of cmd. The other post has instructions on how to permanently enable autocomplete.
If you want to use cygwin then focus on trying to get autocomplete to work in cygwin. It's been years since I used cygwin, but I thought it was enabled by default. Maybe you need to turn off case sensitivity? How to deactivate uppercase check in cygwin folder autocompletion?
Regardless which shell you use it will only auto complete folder and file names.
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.
I want to create files with different sizes on an Android device.
The one approach I have already tried was to create dummy files using fsutil and push it to devices.
Is there any way to achieve similar result with a command inside adb shell?
Yes, you can do it using dd command. I am not pretty sure it's available in your device. It works fine in my device, you can give a try.
In your host which connects with your Android device, with adb debug turn on, using the following command to create dummy file.
adb shell 'dd if=/dev/zero of=/data/local/tmp/test.img bs=4k count=800'
# check the result
adb shell ls -l /data/local/tmp/test.img
-rw------- shell shell 3276800 2017-06-21 17:33 test.img
The command above will get data from /dev/zero and output to /data/local/tmp/test.img (a public writable directory for Android device), adjust bs and count value in your situation.
I'm trying to deal with some SQLiteDB issues and wanted to use the ABD tool to access my emulators database. When I click on the adb file in the platform-tool file, it opens up but very quickly throws a bunch of text on the window and then closes. Its so fast I can't even tell what it is doing. I tried running as administrator and it didn't change. I'm using Vista if that has anything to do with it.
Any suggestions for how I can even get it to stop from closing so I can enter a command?
You start the command shell (WindowsKey + R, enter cmd in the window that appears and hit Enter.), then use it from there. adb shell is probably the command you need.
C:\> cd \Path\to\platform-tools
C:\Path\to\platform-tools\> adb shell
if you add the path to your environment PATH you don't need to cd there. [This] should be a good example how to do that.
As mentioned by zapl, you need to launch command prompt, add adb directory to path and then running adb commands. You may also be able to pull the trick with DDMS.
In the answer, it was not clear that you have to run a windows cmd.exe terminal program first. Make sure you are in the correct directory, Then start ADB from within this cmd program.
To ensure that windows can find adb.exe ("being in the correct directory), you can either navigate to the location of the adb.exe (usually Platform tools) manually using "cd" command, or update your path statement so that windows can find it regardless of where your cmd.exe prompt is pointing.
This question already has answers here:
How to use ADB Shell when Multiple Devices are connected? Fails with "error: more than one device and emulator"
(15 answers)
Closed 7 years ago.
I know how to install the apk file in to the emulator by command prompt and all that.
But i want to know is it possible to install same apk file in to multiple emulator by giving any specific name ?
Actually i have to test one apk file in to many device. and for that i have started many device. I know how to install it. if the all device are open then it will not get install. So is there any alternate to install that apk file by giving any specific device Emulator id or any name ???
Please help me if there is any idea for it. . .
Thanks.
Yes, you can install an apk on a particular device.
In command, type:
adb devices
// list of devices and its unique ID...
Then type:
adb -s "<deviceIDfromlist>" install "<path-to-apk>"
Step 1: Get the device Ids of all connected device
adb devices
Step 2: Install to a particular device you want to install
adb -s deviceId install path+apk
Example:
Step 1:
C:\Android\android-sdks\platform-tools>adb devices
List of devices attached emulator-5554 device 014FD87107021017
device
Step 2:
C:\Android\android-sdks\platform-tools>adb -s 014FD87107021017 install C:\Users\
user\Documents\appname.apk
Use the following scripts to install apk on multiple devices/emulators.
for SERIAL in $(adb devices | grep -v List | cut -f 1);
do adb -s $SERIAL install -r /path/to/product.apk;
done
Remove -r if you are not reinstalling the apk. Also you can replace "install -r /path/to/product.apk" to other adb commands like working on one single device.
It works for me on real devices but I believe it should also works for emulators.
It is possible to issue install command simultaneously on all connected devices.
The key is to launch adb in a separate process (&).
I came up with the following script to simultaneously fire-off installation on all of the connected devices of mine and finally launch installed application on each of them:
#!/bin/sh
function install_job {
adb -s ${x[0]} install -r PATH_TO_YOUR_APK
adb -s ${x[0]} shell am start -n "com.example.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
}
#iterate over devices IP-addresses or serial numbers and start a job
while read LINE
do
eval x=($LINE)
install_job ${x[0]} > /dev/null 2>&1 &
done <<< "`adb devices | cut -sf 1`"
echo "WATING FOR INSTALLATION PROCESSES TO COMPLETE"
wait
echo "DONE INSTALLING"
Note 1: the STDOUT and STDERR are suppressed. You won't see any "adb install" operation result. This may be improved, I guess, if you really have to
Note 2: you could also improve script by providing args instead of hardcoded path and activity names.
That way you:
Don't have to manually perform install on each device
Don't have to wait for one install to finish in order to execute another one (adb tasks are launched in parallel)
yes you can install your apk file in multiple emulator for that you have to give the name in command prompt here is the link for guidance
http://developer.android.com/guide/developing/tools/emulator.html
You can install on multiple devices at a time using USB debugging.
In Eclipse
Run--> Run Configurations --> choose your project (on left) -->Target --> Launch on All compatible devices.
The selected project will be installed on all the connected devices
We are able to run instrumentation tests of Android from the command line on Windows by launching:
adb shell
am instrument -w <package.test>/android.test.InstrumentationTestRunner
This gives us good results.
Using the same architecture, we are unable to run the same in Kubuntu.
We have the same setup in Kubuntu.
Can someone let us know, if there are packages with same name.. Then what package will the adb shell point?
How will the emulator connect with adb shell from cmd line?
DO we need to do any changes to do so in Kubuntu ?
You need to explain what errors you are seeing.
If you have the same setup under Kubuntu, i.e. the Android SDK is installed, with tools like adb accessible in your path, then everything should work fine.
In response to your individual points (and these answers are the same on Windows, Mac or Linux):
It is not possible to have more than one Android package installed on a device or emulator with the same package name.
You can connect to the emulator — the same as for any device — by calling adb shell, e.g.:
adb -d shell if you have a single USB-attached device
adb -e shell if you have a single emulator running
adb -s emulator-5554 shell to specify a particular emulator (or device serial number)
You don't need to change anything between operating systems. The difference would be with setting up a device, as you need to modify udev rules on Linux, and install the USB driver on Windows