Add and use $SOURCE_FOLDER and $APP_NAME

This commit is contained in:
Benjamin Loison 2024-05-01 23:03:09 +02:00
parent 9af3b32820
commit aca86e3344
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -2,24 +2,28 @@ SDK_FOLDER=/usr/lib/android-sdk
PLATFORM=$SDK_FOLDER/platforms/android-33
BUILD_TOOLS=$SDK_FOLDER/build-tools/30.0.3
SOURCE_FOLDER=net/hanshq/hello
APP_NAME=Hello
mkdir -p build/gen build/apk
"$BUILD_TOOLS/aapt" package -f -m -J build/gen/ -S res \
-M AndroidManifest.xml -I "$PLATFORM/android.jar"
javac --release 11 -classpath "$PLATFORM/android.jar" -d build/obj \
build/gen/net/hanshq/hello/R.java java/net/hanshq/hello/MainActivity.java
build/gen/$SOURCE_FOLDER/R.java java/$SOURCE_FOLDER/MainActivity.java
"$BUILD_TOOLS/d8" --release --lib "$PLATFORM/android.jar" \
--output build/apk/ build/obj/net/hanshq/hello/*.class
--output build/apk/ build/obj/$SOURCE_FOLDER/*.class
"$BUILD_TOOLS/aapt" package -f -M AndroidManifest.xml -S res/ \
-I "$PLATFORM/android.jar" \
-F build/Hello.unsigned.apk build/apk/
-F build/$APP_NAME.unsigned.apk build/apk/
"$BUILD_TOOLS/zipalign" -f -p 4 \
build/Hello.unsigned.apk build/Hello.aligned.apk
build/$APP_NAME.unsigned.apk build/$APP_NAME.aligned.apk
"$BUILD_TOOLS/apksigner" sign --ks keystore.jks \
--ks-key-alias androidkey --ks-pass pass:android \
--key-pass pass:android --out build/Hello.apk \
build/Hello.aligned.apk
--key-pass pass:android --out build/$APP_NAME.apk \
build/$APP_NAME.aligned.apk