Skip to content

Instantly share code, notes, and snippets.

@kuwabarahiroshi
Created January 20, 2014 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuwabarahiroshi/8518384 to your computer and use it in GitHub Desktop.
Save kuwabarahiroshi/8518384 to your computer and use it in GitHub Desktop.
Androidアプリをビルドするときにantを使って署名付APKを作成するシェルスクリプト。 brewでandroid-sdkをインストールしている前提です。 署名する際にkeystoreファイルのパスワードを求められますが、expectコマンドで自動化しています。
#! /bin/bash
expect -f - <<EOD
set timeout -1
set pass "YOUR-PASSWORD"
spawn ant -f build.xml clean release -Dsdk.dir=$(brew --prefix android-sdk)
expect "(store:production.keystore):" { send "\$pass\r" }
expect "Please enter password for alias 'mykey':" { send "\$pass\r" }
expect eof
catch wait result
exit [lindex \$result 3]
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment