#The Android Shell A 'shell' is a program that listens to keyboard input from a user and performs actions as directed by the user. Android devices come with a simple shell program. This shell program is mostly undocumented.
Since many people are curious about it I thought I'd write up some documentation for it. Currently this documentation is incomplete, sorry! ##Common problems The built-in shell has very limited error handling.
![Line Line](/uploads/1/2/5/3/125390102/340154139.jpg)
When you type a command name incorrectly it will say 'permission denied', even though the real problem is that it couldn't find the command: $ dir dir: permission denied b' to copy a file between file systems. Nandread ndc netcfg netd netstat newfsmsdos notify omxtests pand ping pm pppd printenv ps List active processes. Qemu-props qemud racoon radiooptions reboot Reboot the device.
The Android Emulator lets you develop and test Android apps without using a physical device. This page describes command-line features that you can use with the Android Emulator. For information about using the Android Emulator UI, see Run Apps on the Android Emulator. Starting the emulator.
Record renice rild rm Remove a file. Rmdir Remove a directory. Rmmod route rtptest run-as schedtest schedtop sdcard sdptool sendevent service servicemanager setconsole setprop setupfs sh showlease sleep smd stagefright start Starts the Android runtime. Stop Stops the Android runtime. Surfaceflinger svc sync systemserver tc testid3 toolbox top Shows which processes are currently using the most CPU time. Umount uptime Prints how long your device has been running since it was last booted.
Vdc vmstat vold watchprops wipe wpacli wpasupplicant $ ls /system/xbin add-property-tag btool check-lost+found dexdump dhdutil hcidump latencytop librank opcontrol oprofiled procmem procrank rawbu scp Secure copy program. (Used to copy files over the network.) showmap showslab sqlite3 Used to administer SQLite databases. Strace System trace command - use to see what system calls a program makes. Su Start a shell with root privileges. #Versions of the Android Shell.
Android 1.0 used a shell that had no tab completion or history editing. Android 2.3 added history editing. You can for example use the up/down arrows to edit previous commands. #Other shells #Busybox Busybox is a program that contains a shell and a set of command line utilities. Search Android Market for 'Busybox' and you should find some versions you can install. The Busybox shell includes tab completion and history editing. Some versions of Busybox for Android do not require that you root your phone.
#Debian utilities You can install the full Debian shell and utilities. (Debian is a popular desktop Linux distribution.) I don't know the details, and it may require a 'rooted' phone. Try a web search for 'Debian Android install'. #Custom ROMs Some custom ROMs come with their own shells and utilities. If you are using a custom ROM, check its documentation to find out what's available.
Using an Android Emulator Always use x86 emulators (or x8664 for testing 64-bit APKs). Although arm emulators exist, they are so slow that they are not worth your time.
Building for Emulation You need to target the correct architecture via GN args: targetcpu = 'x86' # or 'x64' if you have an x8664 emulator Creating an Emulator Image By far the easiest way to set up emulator images is to use Android Studio. If you don't have an already, you can create a blank one to be able to reach the Virtual Device Manager screen. Refer to: Where files live:. System partition images are stored within the sdk directory. Emulator configs and data partition images are stored within /.android/avd/. Choosing a Skin Choose a skin with a small screen for better performance (unless you care about testing large screens). Choosing an Image Android Studio's image labels roughly translate to the following: AVD “Target” GMS?
Build Properties Google Play This has GMS user/ release-keys Google APIs This has GMS userdebug/ dev-keys No label AOSP image, does not have GMS eng/ test-keys. If you're not sure which to use, choose Google APIs. Configuration “Show Advanced Settings” scroll down:. Set internal storage to 4000MB (component builds are really big). Set SD card to 1000MB (our tests push a lot of files to /sdcard).
Known Issues. Our test & installer scripts do not work with pre-MR1 Jelly Bean.
Component builds do not work on pre-KitKat (due to the OS having a max number of shared libraries). Jelly Bean and KitKat images sometimes forget to mount /sdcard:(. This causes tests to fail.
To ensure it's there: adb -s emulator-5554 shell mount (look for /sdcard). Can often be fixed by editing /.android/avd/YOURDEVICE/config.ini. Look for hw.sdCard=no and set it to yes Cloning an Image Running tests on two emulators is twice as fast as running on one.
Rather than use the UI to create additional avds, you can clone an existing one via: $ tools / android / emulator / cloneavd. Py - source - ini /.android/ avd / EMULATORID. Ini - dest - ini /.android/ avd / EMULATORIDCLONED. Ini - display - name 'Cloned Emulator' Starting an Emulator from the Command Line Refer to:. Ctrl-C will gracefully close an emulator.
Basic Command Line Use $ /Android/ Sdk / emulator / emulator @EMULATORID Running a Headless Emulator You can run an emulator without creating a window on your desktop (useful for ssh): $ sudo apt - get install xvfb - run $ xvfb - run /Android/ Sdk / emulator / emulator - gpu off @EMULATORID Writable system partition Unlike physical devices, an emulator's /system partition cannot be modified by default (even on rooted devices). If you need to do so (such as to remove a system app), you can start your emulator like so: $ /Android/ Sdk / emulator / emulator - writable - system @EMULATORID Remote Desktop For better graphics performance, use virtualgl (Googlers, see ): $ vglrun /Android/ Sdk / emulator / emulator @EMULATORID Using an Emulator. Emulators show up just like devices via adb devices. Device serials will look like “emulator-5554”, “emulator-5556”, etc.