Call WasmEdge functions from an Android APK app
The demo project is . You can build the project using the Gradle tool or using the Android Stuido IDE.
- Setup environment variable
- Run Command
./gradlew assembleRelease
Open this folder with Android Studio 2020.3.1 or later.
Review of the source code
The Android UI app is written in Kotlin, and it uses JNI (Java Native Interface) to load a C shared library, which in turn embeds WasmEdge.
The Android UI application is . It is written in Kotlin using the Android SDK.
The C shared library source code wasmedge_lib.cpp
is available here. It uses the WasmEdge C SDK to embed a WasmEdge VM and execute the WebAssembly function.
The WebAssembly function
The factorial.wat
is a to compute factorial numbers. It is compiled into WebAssembly using the WABT tool.