diff options
author | Rami Santina <[email protected]> | 2011-07-26 13:39:34 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-07-26 13:39:34 +0300 |
commit | e8a8fdda769277496772444fa4f99f863e9f355a (patch) | |
tree | 82f1be259c5ef67d57e32b8cc9ae7cfaae47b9ab | |
parent | 2488c4de3e5fe7c4b8258af3fb8aae9b4d5091ce (diff) |
Added android packaging for android gluegen-rt.apk
the apk package can be installed on android device
using adb install gluegen-rt.apk
reference package on device is com.jogamp.gluegen
gerenic icons is added to be replaced by jogamp logo
changes to apk can be controled thru manifest lib/android/AndroidManifest.xml
-rw-r--r-- | make/build.xml | 99 | ||||
-rw-r--r-- | make/lib/android/AndroidManifest.xml | 18 | ||||
-rw-r--r-- | make/lib/android/res/drawable-hdpi/icon.png | bin | 0 -> 4147 bytes | |||
-rw-r--r-- | make/lib/android/res/drawable-ldpi/icon.png | bin | 0 -> 1723 bytes | |||
-rw-r--r-- | make/lib/android/res/drawable-mdpi/icon.png | bin | 0 -> 2574 bytes | |||
-rw-r--r-- | make/lib/android/res/layout/main.xml | 12 | ||||
-rw-r--r-- | make/lib/android/res/values/strings.xml | 5 | ||||
-rwxr-xr-x | make/scripts/make.gluegen.all.android-armv7-cross.sh | 22 |
8 files changed, 142 insertions, 14 deletions
diff --git a/make/build.xml b/make/build.xml index 89426ec..4c75314 100644 --- a/make/build.xml +++ b/make/build.xml @@ -685,30 +685,105 @@ </filterchain> </copy> </target> - + <target name="android.package" depends="gluegen.cpptasks.detect.os,gluegen.build.check.java" if="isAndroid"> + <property name="dex.file.name" value="classes.dex" /> + <property name="intermediate.dex.file" location="${build}/apk-temp/${dex.file.name}" /> + <property name="resource.package.file.name" value="${build}/gluegen-rt.ap_" /> + <property name="signed.file.name" value="${build}/gluegen-rt-sign.ap_" /> + <property name="release.file.name" value="${build}/gluegen-rt.apk" /> <mkdir dir="${build}/apk-temp/bin/lib/armeabi" /> + <mkdir dir="${build}/apk-temp/bin/lib/src" /> + <mkdir dir="${build}/apk-temp/bin/lib/assets" /> <copy todir="${build}/apk-temp/bin/lib/armeabi"> <fileset dir="${build}/obj"> <include name="*gluegen-rt.${native.library.suffix}" /> </fileset> </copy> - - <delete file="${build}/gluegen-rt.apk" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> + <delete file="${intermediate.dex.file}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + <delete file="${release.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + + <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> <arg line="--dex"/> - <arg line="--output=${build}/gluegen-rt.apk"/> + <arg line="--output=${intermediate.dex.file}"/> <arg line="${build}/gluegen-rt.jar"/> <arg line="${build}/apk-temp/"/> <!-- need to be installed .. etc --> </exec> - <delete file="${build}/gluegen.apk" includeEmptyDirs="true" quiet="true" failonerror="false" /> - <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> - <arg line="--dex"/> - <arg line="--output=${build}/gluegen.apk"/> - <arg line="${build}/gluegen.jar"/> - <arg line="${build}/apk-temp/"/> <!-- need to be installed .. etc --> - </exec> + + <property name="version.code" value="" /> + <property name="build.packaging.debug" value="false" /> + <property name="build.signing.debug" value="false" /> + <property name="resource.dir" value="lib/android/res" /> + <property name="resource.absolute.dir" location="${resource.dir}" /> + <property name="filter.abi" value="" /> + + <path id="android.antlibs"> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/anttasks.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/sdklib.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/androidprefs.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/apkbuilder.jar" /> + <pathelement path="${env.ANDROID_SDK_HOME}/tools/lib/jarutils.jar" /> + </path> + + <echo>Packaging resources</echo> + <exec dir="." executable="aapt" logError="true" failonerror="true" failifexecutionfails="true"> + <arg line="package"/> + <arg line="-v"/> + <arg line="--debug-mode"/> + <arg line="-f"/> + <arg line="-j"/> + <arg line="${build}/gluegen-rt.jar"/> + <arg line="-M"/> + <arg line="lib/android/AndroidManifest.xml"/> + <arg line="-S"/> + <arg line="lib/android/res"/> + <arg line="-A"/> + <arg line="${build}/apk-temp/bin/lib/assets"/> + <arg line="-I"/> + <arg line="${env.ANDROID_SDK_HOME}/platforms/android-${env.ANDROID_SDK_VERSION}/android.jar"/> + <arg line="-F"/> + <arg line="${resource.package.file.name}"/> + <arg line="${build}/apk-temp/"/> + </exec> + + <!-- TODO: Remove temp key and use jogamp signer --> + <echo>Generating temp debug key...</echo> + <exec dir="." executable="keytool" failonerror="true"> + <arg value="-genkey "/> + <arg value="-alias" /> + <arg value="debug" /> + <arg value="-keystore" /> + <arg value="${build}/apk-temp/debug.keystore" /> + <arg value="-keypass" /> + <arg value="jogamp" /> + <arg value="-dname" /> + <arg value="CN=GLUEGEN Debug,O=JOGAMP,C=US" /> + <arg value="-storepass" /> + <arg value="jogamp" /> + </exec> + + <echo>Signing apk...</echo> <!-- needed for install on device --> + <signjar + jar="${resource.package.file.name}" + signedjar="${signed.file.name}" + keystore="${build}/apk-temp/debug.keystore" + storepass="jogamp" + alias="debug" + keypass="jogamp" + verbose="true" /> + + <echo>Running zip align on final apk...</echo> + <exec dir="." executable="${env.ANDROID_SDK_HOME}/tools/zipalign" failonerror="true"> + <arg line="-v" /> + <arg value="-f" /> + <arg value="4" /> + <arg path="${signed.file.name}" /> + <arg path="${release.file.name}" /> + </exec> + <delete dir="${build}/apk-temp" includeEmptyDirs="true" quiet="true" failonerror="false" /> + <delete file="${resource.package.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> + <delete file="${signed.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" /> </target> <target name="base.compile" depends="init, gluegen.build.java, gluegen.build.c, tag.build" /> diff --git a/make/lib/android/AndroidManifest.xml b/make/lib/android/AndroidManifest.xml new file mode 100644 index 0000000..7ddeac8 --- /dev/null +++ b/make/lib/android/AndroidManifest.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.jogamp.gluegen" + android:versionCode="1" + android:versionName="1.0"> + <uses-sdk android:minSdkVersion="8" /> + + <application android:icon="@drawable/icon" android:label="@string/app_name"> + <activity android:name=".GluegenActivity" + android:label="@string/app_name"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + </application> +</manifest> diff --git a/make/lib/android/res/drawable-hdpi/icon.png b/make/lib/android/res/drawable-hdpi/icon.png Binary files differnew file mode 100644 index 0000000..8074c4c --- /dev/null +++ b/make/lib/android/res/drawable-hdpi/icon.png diff --git a/make/lib/android/res/drawable-ldpi/icon.png b/make/lib/android/res/drawable-ldpi/icon.png Binary files differnew file mode 100644 index 0000000..1095584 --- /dev/null +++ b/make/lib/android/res/drawable-ldpi/icon.png diff --git a/make/lib/android/res/drawable-mdpi/icon.png b/make/lib/android/res/drawable-mdpi/icon.png Binary files differnew file mode 100644 index 0000000..a07c69f --- /dev/null +++ b/make/lib/android/res/drawable-mdpi/icon.png diff --git a/make/lib/android/res/layout/main.xml b/make/lib/android/res/layout/main.xml new file mode 100644 index 0000000..3a5f117 --- /dev/null +++ b/make/lib/android/res/layout/main.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > +<TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/hello" + /> +</LinearLayout> diff --git a/make/lib/android/res/values/strings.xml b/make/lib/android/res/values/strings.xml new file mode 100644 index 0000000..779e490 --- /dev/null +++ b/make/lib/android/res/values/strings.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="hello">Hello World, GluegenActivity!</string> + <string name="app_name">Gluegen</string> +</resources> diff --git a/make/scripts/make.gluegen.all.android-armv7-cross.sh b/make/scripts/make.gluegen.all.android-armv7-cross.sh index 21f4263..5ac9a9d 100755 --- a/make/scripts/make.gluegen.all.android-armv7-cross.sh +++ b/make/scripts/make.gluegen.all.android-armv7-cross.sh @@ -9,14 +9,32 @@ export TARGET_IP=beagle01 export TARGET_ROOT=projects-cross export TARGET_ANT_HOME=/usr/share/ant +export ANDROID_SDK_VERSION=9 + +if [ $# -eq "0" ] ; then + echo "Usage: `basename $0` <ANDROID_SDK_HOME> <NDK_ROOT>" + echo "Default: ANDROID_SDK_HOME=/usr/local/android-sdk-linux_x86" + echo "Default: NDK_ROOT=/usr/local/android-ndk-r6" +fi + +if [ $# -ge "2" ] ; then +ANDROID_SDK_HOME=$1 +shift +NDK_ROOT=$1 +shift +fi + +echo $ANDROID_SDK_HOME +echo $NDK_ROOT + if [ -z "$NDK_ROOT" ] ; then - NDK_ROOT=/opt-linux-x86/android-ndk-r6 + NDK_ROOT=/usr/local/android-ndk-r6 fi export NDK_ROOT NDK_TOOLCHAIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi if [ -z "$ANDROID_SDK_HOME" ] ; then - ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86 + ANDROID_SDK_HOME=/usr/local/android-sdk-linux_x86 fi export ANDROID_SDK_HOME |