https://github.com/gershnik/android-cmdline-jni
How to create a native Android command-line application that loads and uses ART virtual machine
https://github.com/gershnik/android-cmdline-jni
android-runtime command-line cplusplus cpp jni-android
Last synced: 11 months ago
JSON representation
How to create a native Android command-line application that loads and uses ART virtual machine
- Host: GitHub
- URL: https://github.com/gershnik/android-cmdline-jni
- Owner: gershnik
- License: bsd-3-clause
- Created: 2021-03-26T17:29:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-29T05:18:01.000Z (about 5 years ago)
- Last Synced: 2025-04-18T19:41:59.979Z (12 months ago)
- Topics: android-runtime, command-line, cplusplus, cpp, jni-android
- Language: C++
- Homepage:
- Size: 14.6 KB
- Stars: 10
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This repository contains minimal code to create a native Android command-line application that loads and uses ART virtual machine.
More details can be found at https://gershnik.github.io/2021/03/26/load-art-from-native.html
To build and run:
* Make sure you have an emulator running or device connected.
* Run the following, substituting
* your NDK location for `$ANDROID_NDK_PATH`
* `Release` or `Debug` etc. for `$BUILD_TYPE`
* `x86_64`, `x86`, `armeabi-v7a` or `arm64-v8a` for `$NDK_ARCH`
* If desired change `ANDROID_PLATFORM` value to something bigger than 19
```bash
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=$ANDROID_NDK_PATH/build/cmake/android.toolchain.cmake \
-DANDROID_ABI:STRING=$NDK_ARCH \
-DANDROID_PLATFORM:STRING=19 \
-DANDROID_STL:STRING=c++_static
cmake --build . --config $BUILD_TYPE --target run
```