Skip to content

Latest commit

 

History

History
116 lines (94 loc) · 3.63 KB

README.md

File metadata and controls

116 lines (94 loc) · 3.63 KB

AndroidShell (Mac Os Commands)

MAPS

Debug KeyStore

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

ADB

Simulate Application Being Killed

``` // 1 - Exit your app using home button // 2 - After that adb shell ps // Find the process id adb shell ps | grep your.app.package // Then find the line with app name package adb shell kill -9 21997 // Kill the app by PID // 3 - Now return to the app using the task switcher ```

Screen Recording using Android 4.4

``` adb shell screenrecord --verbose /sdcard/nexus5.mp4 // Basic recording from shell // Press Ctrl-C to stop screenrecord --verbose --time-limit 30 /sdcard/nexus5.mp4 // Recording for 30 seconds screenrecord --verbose --bit-rate 8000000 --time-limit 30 /sdcard/nexus5.mp4 // Recording for 30 seconds with 8Mbps bitrate screenrecord --verbose --rotate /sdcard/nexus5.mp4 // Record in portrait view / horizontal ```

Retrieve application's private data and databases for non debug application without root access

``` // Get a backup of your application data adb backup --apk // Change the .ab in .tar dd if=backup.ab bs=24 skip=1 | openssl zlib -d > backup.tar // Untar backup.tar tar xfv backup.tar // Go in you app private dir cd apps/ ``` > You'll need : > - adb activated > - physical access to unlocked device > - works on Nexus 5 at least, might not work with other devices. > __allowBackup=false will break thos method__

Use ADB over Wi-Fi without extra application or software

__Prerequisites__ Android device and computer should be connected in same network. * Connect Android device with USB cable to computer * Use following command in terminal to make sure adb is running in USB mode. ``` $adb usb // Restarting in USB mode // Connect to the device over USB. ```
  • Execute following command in terminal to make sure adb identify/list gets connected with the device.
$adb devices
  • Change adb mode from USB to tcpip using following command.
$adb tcpip 5555
// Restarting in TCP mode port: 5555
  • Now, adb is running over TCP/IP mode, Let’s find IP address of Android device. Go to Settings in Android device -> About -> Status -> IP address. note down the IP address of connected Android Device.
  • Use following command to connect ADB with IP address
$adb connect #.#.#.# 
// Connected to #.#.#.#:5555
  • Now adb is working over Wi-fi, You can remove USB cable from Android device.
  • To confirm adb is working over Wi-fi and your device is still connect. you can use following command
$adb devices
#.#.#.#:5555 device

You’re now ready to go!, Enjoy ADB over Wi-fi. Use following command to change ADB mode to USB

$adb usb

See the executed SQL statements in plain text in logcat

``` adb shell setprop log.tag.SQLiteLog V adb shell setprop log.tag.SQLiteStatements V adb shell stop adb shell start ``` That's it. Whenever any of the installed apps now accesses the database you should see the executed statement in the log output.

Testing

Execute Monkey to test user interaction

The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.

adb shell monkey [options] <event-count>
// Basic, make 500 random actions
adb shell monkey -p your.package.name -v 500 

Complete information at http://developer.android.com/tools/help/monkey.html