Integrating ACL Pack into an Android NDK Project
This guide walks you through adding ACL Pack to an Android NDK project, initializing the license, and running your first operator.
What you need
- Android Studio with NDK 26.3+ (Clang 17)
- ACL Pack Android arm64-v8a SDK zip
- A valid
license.datfor your tier
Project layout
app/src/main/cpp/
├── CMakeLists.txt
├── include/acl/ # from SDK zip
└── native-lib.cpp
app/src/main/jniLibs/arm64-v8a/
└── libacl.a # from SDK zip
app/src/main/assets/
└── license.datCMakeLists.txt
cmake
cmake_minimum_required(VERSION 3.22.1)
project("acl_demo")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(acl STATIC IMPORTED)
set_target_properties(acl PROPERTIES
IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/../jniLibs/arm64-v8a/libacl.a
)
add_library(native-lib SHARED native-lib.cpp)
target_include_directories(native-lib PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(native-lib acl m log atomic z)Native code
cpp
#include <jni.h>
#include <acl/acl.h>
#include <acl/api.h>
extern "C" JNIEXPORT jint JNICALL
Java_com_example_acl_MainActivity_initLicense(JNIEnv* env, jobject /*thiz*/, jstring path) {
const char* cpath = env->GetStringUTFChars(path, nullptr);
int rv = acl::init(cpath);
env->ReleaseStringUTFChars(path, cpath);
return rv;
}
extern "C" JNIEXPORT void JNICALL
Java_com_example_acl_MainActivity_processFrame(
JNIEnv* env, jobject /*thiz*/,
jlong src, jlong dst, jint w, jint h) {
acl::neon::cvtcolor::channelSwap<acl::BGR2RGB>(
reinterpret_cast<uint8_t*>(src),
reinterpret_cast<uint8_t*>(dst),
w, h
);
}License file
Place license.dat in assets/ and copy it to the app’s private storage at runtime:
kotlin
val licenseFile = File(filesDir, "license.dat")
assets.open("license.dat").use { input ->
licenseFile.outputStream().use { output ->
input.copyTo(output)
}
}
val rv = initLicense(licenseFile.absolutePath)Common pitfalls
- Wrong ABI: ACL Pack only ships
arm64-v8a. Make sureabiFiltersincludesarm64-v8a. - Tier mismatch: A Starter license linked against a Pro library returns
-1005. - Missing
init(): Any operator called beforeacl::init()succeeds returns-1001.
Next steps
Read the full integration guide and the API reference.
Download the latest Android SDK from the v1.0.3 release.