From 332105d56ec24facaae01004b036b4e4f4cfbd31 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Tue, 23 Sep 2025 21:43:27 +0200 Subject: [PATCH 1/4] Minor markdown lint and copyedit --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0d3523b..30ecf08 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,16 @@ This Android Studio project wraps the [Desktop Sample App](https://github.com/el ## Runtime Notes -The pre-built Erlang runtime for Android ARM/ARM64/x86 is embedded in this example git repository. These native runtime files include Erlang OTP and the exqlite nif to use SQLite on the mobile. These runtimes are generated using the CI of the [Desktop Runtime](https://github.com/elixir-desktop/runtimes) repository. +The pre-built Erlang runtime for Android ARM/ARM64/x86 is embedded in this example git repository. These native runtime files include Erlang/OTP and the exqlite nif to use SQLite on the mobile. These runtimes are generated using the CI of the [Desktop Runtime](https://github.com/elixir-desktop/runtimes) repository. -Because Erlang OTP has many native hooks for networking and cryptographics the Erlang version used to compile your App must match the pre-built binary release that is embedded. In this example that is Erlang OTP 25.0.4. This sample is shipping with a `.tool-versions` file that `asdf` will automatically use to automate this requirement. +Because Erlang/OTP has many native hooks for networking and cryptographics the Erlang version used to compile your App must match the pre-built binary release that is embedded. In this example that is Erlang/OTP 25.0.4. This sample is shipping with a `.tool-versions` file that `asdf` will automatically use to automate this requirement. ## How to build & run 1. Install [Android Studio](https://developer.android.com/studio) + NDK. 1. Install git, npm, asdf - ``` + ```shell sudo apt install git npm curl git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2 echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc @@ -21,25 +21,24 @@ Because Erlang OTP has many native hooks for networking and cryptographics the E . $HOME/.asdf/asdf.sh ``` -1. Install Erlang-OTP (with openssl) in the same version 26.2.5 as the bundled runtime edition: +1. Install Erlang/OTP (with openssl) in the same version 26.2.5 as the bundled runtime edition: ``` asdf install erlang 26.2.5 asdf install elixir 1.17.2-otp-26 ``` -1. Go to "Files -> New -> Project from Version Control" and enter this URL: https://github.com/elixir-desktop/android-example-app/ +1. Go to "Files -> New -> Project from Version Control" and enter this URL: [https://github.com/elixir-desktop/android-example-app/] or open your locally cloned directory. 1. Start the App - ## Customize app name and branding Update these places with your package name: 1) App name in [strings.xml](app/src/main/res/values/strings.xml#L2) and [settings.gradle](settings.gradle) 1) Package names in [Bridge.kt:1](app/src/main/java/io/elixirdesktop/example/Bridge.kt#L1) and [MainActivity.kt:1](app/src/main/java/io/elixirdesktop/example/MainActivity.kt#L1) (rename `package io.elixirdesktop.example` -> `com.yourapp.name` or use the Android Studios refactor tool) -1) App icon: [ic_launcher_foreground.xml](app/src/main/res/drawable-v24/ic_launcher_foreground.xml) and [ic_launcher-playstore.png](app/src/main/ic_launcher-playstore.png) +1) App icon: [ic_launcher_foreground.xml](app/src/main/res/drawable-v24/ic_launcher_foreground.xml) and [ic_launcher-playstore.png](app/src/main/ic_launcher-playstore.png) 1) App colors: [colors.xml](app/src/main/res/values/colors.xml) and launcher background [ic_launcher_background.xml](app/src/main/res/values/ic_launcher_background.xml) ## Known todos @@ -52,11 +51,11 @@ Running the app for the first time will extract the full Elixir & App runtime at This sample only launch the elixir app and shows it in an Android WebView. There is no integration yet with the Android Clipboard, sharing or other OS capabilities. They can though easily be added to the `Bridge.kt` file when needed. -## Other notes +## Other notes -- Android specific settings, icons and metadata are all contained in this Android Studio wrapper project. +- Android specific settings, icons and metadata are all contained in this Android Studio wrapper project. -- `Bridge.kt` and the native library are doing most of the wrapping of the Elixir runtime. +- `Bridge.kt` and the native library are doing most of the wrapping of the Elixir runtime. ## Screenshots From 03ccc601d8884e5e33d1248ec54b1f80247a3ae6 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Tue, 23 Sep 2025 21:44:15 +0200 Subject: [PATCH 2/4] Modernize asdf instructions for >= 0.16 --- README.md | 15 +++++++-------- app/run_mix | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 30ecf08..728d3f3 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,20 @@ Because Erlang/OTP has many native hooks for networking and cryptographics the E ## How to build & run 1. Install [Android Studio](https://developer.android.com/studio) + NDK. -1. Install git, npm, asdf +1. Install [asdf](https://asdf-vm.com/guide/getting-started.html), for example: ```shell sudo apt install git npm curl - git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2 - echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc - echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc - . $HOME/.asdf/asdf.sh + curl --silent --location -o - https://github.com/asdf-vm/asdf/releases/download/v0.18.0/asdf-v0.18.0-linux-amd64.tar.gz | tar xzf - -C ~/bin/ + export PATH="$PATH:~/bin" ``` 1. Install Erlang/OTP (with openssl) in the same version 26.2.5 as the bundled runtime edition: - ``` - asdf install erlang 26.2.5 - asdf install elixir 1.17.2-otp-26 + ```shell + asdf plugin add erlang + asdf plugin add elixir + cd app && asdf install ``` 1. Go to "Files -> New -> Project from Version Control" and enter this URL: [https://github.com/elixir-desktop/android-example-app/] or open your locally cloned directory. diff --git a/app/run_mix b/app/run_mix index f87e127..9342c6a 100755 --- a/app/run_mix +++ b/app/run_mix @@ -1,5 +1,5 @@ #!/bin/bash -. ~/.asdf/asdf.sh +export PATH="$HOME/.asdf/shims:$PATH" set -e BASE=`pwd` From a2a14c6953f1f76b5283028754f4a9203b93b4ee Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Tue, 23 Sep 2025 21:44:58 +0200 Subject: [PATCH 3/4] Simplify documented version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 728d3f3..05461d1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This Android Studio project wraps the [Desktop Sample App](https://github.com/el The pre-built Erlang runtime for Android ARM/ARM64/x86 is embedded in this example git repository. These native runtime files include Erlang/OTP and the exqlite nif to use SQLite on the mobile. These runtimes are generated using the CI of the [Desktop Runtime](https://github.com/elixir-desktop/runtimes) repository. -Because Erlang/OTP has many native hooks for networking and cryptographics the Erlang version used to compile your App must match the pre-built binary release that is embedded. In this example that is Erlang/OTP 25.0.4. This sample is shipping with a `.tool-versions` file that `asdf` will automatically use to automate this requirement. +Because Erlang/OTP has many native hooks for networking and cryptographics the Erlang version used to compile your App must match the pre-built binary release that is embedded. In this example that is Erlang/OTP 26.2.5. This sample is shipping with a `.tool-versions` file that `asdf` will automatically use to automate this requirement. ## How to build & run @@ -19,7 +19,7 @@ Because Erlang/OTP has many native hooks for networking and cryptographics the E export PATH="$PATH:~/bin" ``` -1. Install Erlang/OTP (with openssl) in the same version 26.2.5 as the bundled runtime edition: +1. Install Erlang/OTP (with openssl) in the same version as the bundled runtime edition: ```shell asdf plugin add erlang From 19fe636f799008f9567c44787f8c973cb9ecd86e Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Tue, 23 Sep 2025 22:06:03 +0200 Subject: [PATCH 4/4] Recommend nodejs install via asdf --- README.md | 3 ++- app/.tool-versions | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 05461d1..628ff4c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Because Erlang/OTP has many native hooks for networking and cryptographics the E 1. Install [asdf](https://asdf-vm.com/guide/getting-started.html), for example: ```shell - sudo apt install git npm curl + sudo apt install curl curl --silent --location -o - https://github.com/asdf-vm/asdf/releases/download/v0.18.0/asdf-v0.18.0-linux-amd64.tar.gz | tar xzf - -C ~/bin/ export PATH="$PATH:~/bin" ``` @@ -24,6 +24,7 @@ Because Erlang/OTP has many native hooks for networking and cryptographics the E ```shell asdf plugin add erlang asdf plugin add elixir + asdf plugin add nodejs cd app && asdf install ``` diff --git a/app/.tool-versions b/app/.tool-versions index f4ee3d4..5410499 100644 --- a/app/.tool-versions +++ b/app/.tool-versions @@ -1,2 +1,3 @@ erlang 26.2.5 elixir 1.17.2-otp-26 +nodejs 22.19.0