All Projects → koreader → Android Luajit Launcher

koreader / Android Luajit Launcher

Licence: mit
Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI

Programming Languages

kotlin
9241 projects
lua
6591 projects

Projects that are alternatives of or similar to Android Luajit Launcher

Dart native
Write iOS&Android Code using Dart. This package liberates you from redundant glue code and low performance of Flutter Channel.
Stars: ✭ 564 (+548.28%)
Mutual labels:  jni, ffi, native
Jpegkit Android
Efficient JPEG operations for Android without the risk of an OutOfMemoryException.
Stars: ✭ 154 (+77.01%)
Mutual labels:  ndk, jni, native
Androidsecurity
Android安全实践
Stars: ✭ 150 (+72.41%)
Mutual labels:  ndk, jni, native
winsafe
Windows API and GUI in safe, idiomatic Rust.
Stars: ✭ 110 (+26.44%)
Mutual labels:  native, ffi
Koreader Base
Base framework offering a Lua scriptable environment for creating document readers
Stars: ✭ 81 (-6.9%)
Mutual labels:  luajit, ffi
windigo
Windows API and GUI in idiomatic Go.
Stars: ✭ 187 (+114.94%)
Mutual labels:  native, ffi
libandroidjni
Android JNI bindings library
Stars: ✭ 66 (-24.14%)
Mutual labels:  ndk, native
Jni4android
JNI Generater for Android
Stars: ✭ 261 (+200%)
Mutual labels:  ndk, jni
premake-android-studio
premake5 module for android-studio and gradle build.
Stars: ✭ 24 (-72.41%)
Mutual labels:  ndk, jni
Jnioor
基于C++模板函数与Fluent API设计的JNI反射库,极大的简化JNI反射调用,提高JNI开发效率与稳定性
Stars: ✭ 278 (+219.54%)
Mutual labels:  ndk, jni
Keepalive
Fighting against force-stop kill process on Android with binder ioctl / Android高级保活
Stars: ✭ 376 (+332.18%)
Mutual labels:  ndk, jni
Camerakit Android
Library for Android Camera 1 and 2 APIs. Massively increase stability and reliability of photo and video capture on all Android devices.
Stars: ✭ 5,131 (+5797.7%)
Mutual labels:  ndk, native
Camera2GLPreview
Android camera preview application using Camera2 API and OpenGL ES/Vulkan
Stars: ✭ 140 (+60.92%)
Mutual labels:  ndk, jni
imgui-java
JNI based binding for Dear ImGui
Stars: ✭ 270 (+210.34%)
Mutual labels:  native, jni
PointerScript
Scripting language with pointers and native library access.
Stars: ✭ 26 (-70.11%)
Mutual labels:  native, ffi
NativeGL demo
此程序使用android native代码实现EGL,并使用SurfaceView作为OpenGL绘图窗口。即可提高图形渲染性能,又可使用java层定义的图形界面
Stars: ✭ 43 (-50.57%)
Mutual labels:  ndk, jni
SecurityDemo
ndk进行简单的签名校验,密钥保护demo,android应用签名校验
Stars: ✭ 22 (-74.71%)
Mutual labels:  ndk, jni
Anyndk
🔥 Android native library, make your development faster and easier. Android各种native库,让你的开发更快更简单
Stars: ✭ 35 (-59.77%)
Mutual labels:  ndk, jni
rust-flutter-reactive
This is a sample app to improve consistency over Mobile App Development.
Stars: ✭ 25 (-71.26%)
Mutual labels:  native, ffi
ChangeVoice
NDK语音消息的变声处理
Stars: ✭ 33 (-62.07%)
Mutual labels:  ndk, jni

android-luajit-launcher

License: MIT Codacy Badge

Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI.

NativeActivity is available starting with platform android-9.

Have a look at the Android NDK's "native-plasma" sample activity to get an idea what it does - or rather, is theoretically able to do. While the sample from NDK implements everything in C, in our case, we create a LuaJIT instance and hand off control to it instead. LuaJIT then handles the main loop. In this programming model, we have a thread which presents us with a "main" entry point and allow us to follow our own program flow as long as we poll for and react to events.

A good number of Android native API headers are readily presented via FFI already. I'll probably add more along the way.

For now - and probably ever, since Mike Pall recommends strongly to do so - the compilation of LuaJIT is not integrated into the Android build framework and has to be run separately.

A wrapper script for building LuaJIT is provided. It relies on NDK r15c

Have a look at KOReader's llapp_main.lua file. You can use it as a starting point for your own app.

The real starting point, called from JNI/C, is the run() function in android.lua. It sets up a few things, namely FFI definitions for the Android native API (since it uses that itself for a few things) and some wrapper functions for logging. Also, it registers the "android" module in package.loaded, so you can access it in your own code via require("android"). It also registers a new package loader which can load Lua code from the activity's asset store, so you can use require() for Lua code stored there.

Starting

Init and update the submodules

make update

Compile LuaJIT for all target architecture(s)

make prepare

Compile native code and package APK with gradle

You can see available tasks with

./gradlew tasks

For example, you can build the debug variant for all supported ABIs with

./gradlew assembleDebug

For more examples please look at the Makefile.

To-do

  • a concept to deal with native Lua modules.
  • a loader for native modules that have been put into the activity's library directory?
  • a loader for obb storage, maybe? We could put native Lua modules there, for example.
  • example code for framebuffer access and more
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].