OpenNI2 and Orbbec Astra Mini for Android Nougat 7.1.1 [solved]

Hey everyone,

We recently were able to use the OpenNI2 NiViewer apk for Android (with some advice from orbbec), and wanted to share the details with everyone, in case it may save you time in development.

We were able to get the NiViewer 2.3 sample running on a OnePlus 5 (8gb RAM model) running Android Nougat 7.1.1, a USB C OTG adapter, and an Astra Mini S. Additionally, the phone needs to be rooted and you must change the “selinux” setting from “enforcing” to “permissive” (plenty of information about how to do this on Google). We also copied all of the *.so driver files from the Redist/ folder to the /system/lib directory on the Android phone (not sure if this is required though, but if the apk is having trouble finding the drivers, it may help).

If you’re new to Android development (like me), the following information will help: by default, the Android Studio might build you a 64-bit application if the target device supports this (called arm64-v8a). The OpenNI2 libraries and liborbbec.so file are 32-bit binaries (called armeabi-v7a), and cannot be used by a 64-bit apk. I was able to build the rest of the .so files as arm64-v8a, but there is currently no arm64-v8a version of the liborbbec.so. I’ve contacted Orbbec development to see if it is possible to release a version of this, and will update here if it is. In the meantime: you can force your application to build a 32-bit apk by modifying the build.gradle file for your app module (not the project build.gradle!) to contain the following line regarding the android ndk:

android {
    ...
    defaultConfig {
        ...
        ndk {
            abiFilters "armeabi-v7a" //TODO:Add/change to arm64-v8a after getting liborbbec.so from Orbbec, compiled for correct version.
        }
    }
    buildTypes {
        ...
    }
}

Your application will then happily use the 32-bit libraries.

Thanks again to the Orbbec dev team (especially @Jackson). Hope this helps! Happy developing!

Luke

1 Like

I have a working example published on Github: GitHub - Michael-List/Orbbec_Astra_Example_Android: Orbbec Astra example for Android

1 Like