Compare commits

..
4 Commits
Author SHA1 Message Date
Illusion 147b0ec325 remove launch script 2025-04-06 11:29:24 +02:00
Illusion b643b0b3c2 update README.md to reflect new changes 2025-04-06 11:25:09 +02:00
Illusion ff674affbd unused var in build script 2025-04-06 11:21:38 +02:00
Illusion 135171813f move the main file to the project's root dir 2025-04-06 11:19:41 +02:00
4 changed files with 9 additions and 30 deletions
+5 -3
View File
@@ -4,10 +4,12 @@ This requires that you write some basic bindings to the Android NDK (or use mine
# Building
First you must adjust `build.sh` and `launch.sh` to have correct paths to Android SDK, Android NDK and the Jetbrains RT.
Then set `APK` variable to the desired apk package name. Use Android SDK to install build-tools and platform SDK.
### Prerequisites
- The Android SDK must be installed and the appropriate Odin environment variables must be set.
- The `keytool` binary must be in your PATH
Now you can use `build.sh` to build and install the app, and `launch.sh` to run the application:
### Steps
Run `build.sh` to build and install the app, and `launch.sh` to run the application:
# License
The code is licensed under the Unlicense license. I do not own the app icon (Odin logo). The logo copyright is owned by [GingerBill](https://github.com/gingerbill)
+3 -5
View File
@@ -2,22 +2,20 @@
## TODO: handle different ABIs, currently only builds for arm64
ANDROID_JBR=/home/illusion/android-studio/jbr
# Create a debug signing key to sign our application.
if [ ! -f .keystore ]; then
"$ANDROID_JBR/bin/keytool" -genkey -dname "CN=Android Debug, O=Android, C=US" -keystore .keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 30000
keytool -genkey -dname "CN=Android Debug, O=Android, C=US" -keystore .keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -validity 30000
if [ $? -ne 0 ]; then exit 1; fi
fi
# Build the shared lib
odin build jni -target:linux_arm64 -subtarget:android -build-mode:shared
odin build . -target:linux_arm64 -subtarget:android -build-mode:shared
# Create the proper lib directories and move the shared lib to them
# Rename the shared lib to match what we specified in the AndroidManifest.xml file
# for the android.app.lib_name metadata value
mkdir -p android/lib/lib/arm64-v8a
mv jni.so android/lib/lib/arm64-v8a/libmain.so
mv android-native-example-odin.so android/lib/lib/arm64-v8a/libmain.so
# Bundle the directory into an apk
odin bundle android android -android-keystore:.keystore -android-keystore-password:"android"
-21
View File
@@ -1,21 +0,0 @@
#!/bin/bash
APK=native_example.apk
ANDROID_SDK_ROOT=/home/illusion/Android/Sdk
ANDROID_NDK=$ANDROID_SDK_ROOT/ndk/26.1.10909125
ANDROID_TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
ANDROID_JBR=/home/illusion/android-studio/jbr
BUILD_TOOLS=34.0.0
get_package_activity() {
PACKAGE=$("$ANDROID_SDK_ROOT/build-tools/$BUILD_TOOLS/aapt" dump badging "bin/$APK" | grep package | awk -F"'" '{print $2}')
ACTIVITY=$("$ANDROID_SDK_ROOT/build-tools/$BUILD_TOOLS/aapt" dump badging "bin/$APK" | grep launchable-activity | awk -F"'" '{print $2}')
}
launch() {
get_package_activity
"$ANDROID_SDK_ROOT/platform-tools/adb" shell am start -n "$PACKAGE/$ACTIVITY"
if [ $? -ne 0 ]; then exit 1; fi
}
launch
+1 -1
View File
@@ -36,7 +36,7 @@ engine_init_display :: proc "contextless" (engine: ^engine) {
display := egl.GetDisplay(egl.DEFAULT_DISPLAY)
if display == egl.NO_DISPLAY {
LOG(.INFO, "NativeExampleOdin", "Naterror with eglGetDisplay")
LOG(.INFO, "NativeExampleOdin", "error with eglGetDisplay")
return
}