create simple project without android studio
# -m instructs aapt to create directories under the location specified by -J
# -J specifies where the output goes. Saying -J src will create a file like src/com/example/helloandroid/R.java
# -S specifies where is the res directory with the drawables, layouts, etc
# -I tells aapt where the android.jar is. You can find yours in a location like android-sdk/platforms/android-<API level>/android.jar
aapt package -f -m -J ./src -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-31/android.jar
# compile .class file to obj folder
javac -source 1.7 -target 1.7 -d obj -classpath ./src -bootclasspath /opt/android-sdk/platforms/android-31/android.jar src/com/jumhorn/app/*.java
dx --dex --output=./bin/classes.dex ./obj
# generate apk file
aapt package -f -m -F ./bin/unaligned.apk -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-31/android.jar
# You have to cd to bin directory Otherwise, AAPT won’t put this file at right place in the APK archive (because an APK is like a .zip file)
cd ./bin
aapt add unaligned.apk classes.dex
# check the apk file
aapt list ./bin/unaligned.apk
# Alignment increase the performance of the application and may reduce memory use.
zipalign -f 4 ./bin/unaligned.apk ./bin/aligned.apk
keytool -genkeypair -validity 365 -keystore release.keystore -keyalg RSA -keysize 2048
apksigner sign --ks release.keystore -v1-signing-enabled true -v2-signing-enabled true --out ./bin/app.apk ./bin/aligned.apk
shell script to build this app
- step by step build this app
- use webview to embed website
- expose android api to javascript
- add android accessibility mode api
-
unsupported class file version 55.0
make java to build 1.7 compatible .class file
-
java.io.FileNotFoundException: ./bin/classes.dex
create bin folder for dx to put classes.dex
-
why folder structure com/jumhorn/app
default android folder structure which is domain reversed