Created
February 12, 2016 19:57
-
-
Save nsf/35696d646ae6a86816b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/!/bin/bash | |
set -e | |
export MYROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
MY=$MYROOT/android | |
MYJAVADIR=$MY/src/com/nosmileface/vquest | |
MYNAME=VQuest | |
MYKEYSTORE=/home/nsf/tmp/AndroidKeys/my-developer-key.keystore | |
# =============== NDK ================== | |
pushd $MYROOT/android | |
ndk-build | |
popd | |
# =============== APK ================== | |
mkdir -p $MY/bin/content/lib/armeabi-v7a | |
cp $MY/libs/armeabi-v7a/*.so $MY/bin/content/lib/armeabi-v7a | |
cp -R $MYROOT/assets $MY/bin/content | |
TOOLS="${ANDROID_HOME}/build-tools/22.0.1" | |
ANDROID_JAR="${ANDROID_HOME}/platforms/android-19/android.jar" | |
# Generate R.java | |
$TOOLS/aapt package -v -f -m \ | |
-S $MY/res -J $MY/src -M $MY/AndroidManifest.xml \ | |
-I $ANDROID_JAR | |
# Compile: $MYROOT/oculus/VrAppSupport/SystemUtils/Libs/Android/SystemUtils.jar | |
javac -source 1.6 -target 1.6 -verbose -d $MY/obj \ | |
-classpath "$ANDROID_JAR:$MY/obj" \ | |
-sourcepath $MY/src $MYJAVADIR/*.java | |
# Generate Dalvik VM bytecode | |
$TOOLS/dx --dex --verbose \ | |
--output=$MY/bin/content/classes.dex \ | |
$MY/obj \ | |
$MY/libs \ | |
$MYROOT/oculus/VrAppSupport/SystemUtils/Libs/Android \ | |
$MYROOT/oculus/VrApi/Libs/Android | |
# Pack into APK | |
$TOOLS/aapt package -f -v \ | |
-S $MY/res -M $MY/AndroidManifest.xml \ | |
-I $ANDROID_JAR \ | |
-F $MY/bin/$MYNAME.unsigned.apk \ | |
$MY/bin/content | |
# Sign APK | |
jarsigner -verbose -keystore $MYKEYSTORE \ | |
-storepass developer \ | |
-signedjar $MY/bin/$MYNAME.signed.apk \ | |
$MY/bin/$MYNAME.unsigned.apk \ | |
nsfkey | |
# Zip-align APK file | |
$TOOLS/zipalign -v -f 4 \ | |
$MY/bin/$MYNAME.signed.apk \ | |
$MY/bin/$MYNAME.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment