LoginSignup
24
23

More than 5 years have passed since last update.

Androidをコマンドラインで開発したいとき

Posted at

Androidをコマンドラインで開発したいときによく使うコマンドまとめ。
環境はMac OS Xです

Android SDKをダウンロードしておき、パスを通しておきます

~/.bash_profile
# android-sdk-macosxのパスは、インストールしたディレクトリに置き換えてください
export PATH="$PATH:/Users/xxx/Development/android-sdk-macosx/platform-tools:/
Users/xxx/Development/android-sdk-macosx/tools"

プロジェクトを作成
targetは、$ android list targets で確認可能

android create project --target 1 --name HelloWorld --path `pwd` --activity HelloWorldActivity --package jp.temp.helloworld

Eclipseからプロジェクトを作成した場合などは、
build.xmlを作成します (antに必要)

#  プロジェクトのルート(`pwd`)
#  targetはandroid list targets
android update project --path `pwd` --target 1 --subprojects

ビルド

ant debug

Emulatorを作成
-t(--target)は、android list targets で確認

android create avd -n avd_1_2.3.3 -t 2

Emulator起動

emulator -avd avd_1_2.3.3

アプリを転送

adb install -r HelloWorld-debug.apk
24
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
23