sudo xcodebuild -license to accept the Xcode licence.

TODO: Update notes to reflect avdmanger

Installing

First, you need adb installed. on macOS, using brew, it’s just a case of:

brew cask install java
brew install android-sdk
android update sdk --no-ui --filter 'platform-tools'

$ adb
Android Debug Bridge version 1.0.36
Revision fd9e4d07b0f5-android ...

Then:

android list sdk --all
Refresh Sources:
  Fetching https://dl.google.com/android/repository/addons_list-2.xml
...
Packages available for installation or update: 145
...
  31- SDK Platform Android 5.1.1, API 22, revision 2
...

Then android update sdk -u -a -t 31

$ android list targets
Available Android targets:
----------
id: 1 or "android-22"
     Name: Android 5.1.1
     Type: Platform
     API level: 22
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
$ android create avd -n Evo4G -t android-22 -c 8000MB -s WXGA800
Valid ABIs: no ABIs.
Error: This platform has more than one ABI. Please specify one using --abi.

So.

android list sdk --all | grep 22
...
  61- Android Wear Intel x86 Atom System Image, Android API 22, revision 7
  62- ARM EABI v7a System Image, Android API 22, revision 1
  63- Intel x86 Atom_64 System Image, Android API 22, revision 5
  64- Intel x86 Atom System Image, Android API 22, revision 5
  65- Google APIs ARM EABI v7a System Image, Android API 22, revision 1
  66- Google APIs Intel x86 Atom_64 System Image, Android API 22, revision 5
  67- Google APIs Intel x86 Atom System Image, Android API 22, revision 5
...

$ android update sdk -u -a -t 64

Then

$ android create avd -n Evo4G -t android-22 -c 1000M -s WXGA800
Auto-selecting single ABI x86
Android 5.1.1 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD 'Evo4G' based on Android 5.1.1, Intel Atom (x86) processor,
with the following hardware config:
hw.keyboard.lid=no
hw.lcd.density=160
hw.ramSize=1024
hw.sdCard=yes
vm.heapSize=48
emulator -avd Evo4G
Creating filesystem with parameters:
    Size: 69206016
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4224
    Inode size: 256
    Journal blocks: 1024
    Label:
    Blocks: 16896
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine

But Intel req. hardware stuff, so.. $ android update sdk -u -a -t 64, for the ARM

Add H/W Stuff via:

 145- Intel x86 Emulator Accelerator (HAXM installer), revision 6.0.1
Riks-Laptop:~ richard.watson$ android update sdk -u -a -t 145

Android AVD’s

But first some history about AVDs in general.

Running the emulator standalone via:

./emulator -sysdir . -kernel kernel-qemu -ramdisk ramdisk.img -system system.img -skindir . -skin WVGA800 -datadir .

Fire up the emulator emulator @training & then see if it’s visible adb kill-server; adb devices.

Running APK on emulator

If you need to install it on a specific emulator, you can use: adb -s emulator-5554 -e install -r yourapp.apk where emulator-5554 is the name of the emulator instance (it’s in the titlebar after you run the emulator)

Running for CLI

To Investigate

FROM ksoichiro/android

MAINTAINER ksoichiro "soichiro.kashima@gmail.com"

RUN echo y | android update sdk --filter platform-tools,build-tools-19.0.3,sysimg-17,android-17,extra-android-support --no-ui --force

# Set up and run emulator
RUN echo no | android create avd --force -n test -t android-17
# Avoid emulator assumes HOME as '/'.
ENV HOME /root
ADD wait-for-emulator /usr/local/bin/
ADD start-emulator /usr/local/bin/

RUN mkdir -p /opt/tmp && android create project -g -v 0.9.+ -a MainActivity -k com.example.example -t android-17 -p /opt/tmp
RUN cd /opt/tmp && ./gradlew tasks
RUN rm -rf /opt/tmp

VOLUME /workspace
WORKDIR /workspace