Skip to content

Instantly share code, notes, and snippets.

@tlatsas
Last active December 18, 2015 07:39
Show Gist options
  • Save tlatsas/5747783 to your computer and use it in GitHub Desktop.
Save tlatsas/5747783 to your computer and use it in GitHub Desktop.
android notes

Android notes

development

create a new project

android create project --target 1 \
  --name some_name --path some-path \
  --activity MyActivity --package com.some.name

emulator

To start the emulator named "zorg" run:

emulator -avd zorg -no-boot-anim -scale 0.65 -show-kernel

If you change some emulator hardware settings, then cannot use an existing snapshot. To load the emulator append -no-snapshot-load to the previous command.

To load the emulator manager run the Android Virtual Devices:

android avd	

build and install

To build a debug version use:

ant debug

To install the generated apk, run:

adb install bin/MyFirstApp-debug.apk

or using ant:

ant installd

You can also build + install in one command using:

ant debug install

If you want to install the application on the emulator but in the SD card use:

adb -e install -s filename.apk

Using the -d options does the same but on a real device:

adb -d install -s filename.apk

tools

To launch the Dalvik Debug Monitor run:

ddms

misc

  • To access the host computer IP you need to use the 10.0.2.2 address.
  • To use your physical keyboard with the emulator you need to add and enable the keyboard hardware on the emulator settings

certificates

package certificates into a .p12 file

Android can import .p12 files, which consists of a root certificate, the client certificate and a client key. Use the following command:

openssl pkcs12 -export -in phone.crt \
  -inkey phone.key -certfile ca.crt \
  -name "Phone VPN" -out phone.p12

flashing

fastboot devices
fastboot flash recovery <img file>
fastboot reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment