Search code examples
androidandroid-ndkandroid-sdk-toolsrenderscript

Using RenderScript with Android NDK


I am trying to run a simple example on how to use RenderScript from the android NDK. I found this example :

https://github.com/uelordi01/Call_RenderScript_from_NDK

but when I run my app (from Android studio), it doesn't fine some libraries (it seems like).

Here is the logcat output:

04-26 16:18:11.705 26653-26653/uelordi.android.hellocomputendk_rs 
E/RS Dispatch: Couldn't initialize dispatchTab.ScriptInvokeIDCreate
04-26 16:18:11.705 26653-26653/uelordi.android.hellocomputendk_rs V/rsC++: 
libRS.so init failed!
04-26 16:18:11.705 26653-26653/uelordi.android.hellocomputendk_rs W/linker: 
libRSSupport.so: unused DT entry: type 0x6ffffef5 arg 0x37720
04-26 16:18:12.018 26653-26859/uelordi.android.hellocomputendk_rs 
E/RenderScript: Couldn't load libRSSupportIO.so
04-26 16:18:12.034 26653-26859/uelordi.android.hellocomputendk_rs 
E/RenderScript: Unable to open shared library 
(/data/data/uelordi.android.hellocomputendk_rs//lib/librs.mono.so): dlopen 
failed: library "libRSSupportIO.so" not found
04-26 16:18:12.034 26653-26859/uelordi.android.hellocomputendk_rs     
E/RenderScript: Unable to open system shared library     
(/system/lib/librs.mono.so): (null)
04-26 16:18:12.034 26653-26653/uelordi.android.hellocomputendk_rs E/rsC++: 
Internal error: Object id 0.

(The renderscript file name is mono.rs)

I think I am supposed to add some libraries somewhere (libRS.so, libRSSupportIO.so) but I have no idea where and how and WHY (since the exemple is supposed to work by himself)

this error happens on the following line: sc->forEach_root(inputAlloc, outputAlloc);

side question:

I looked over the internet but didn't find much (nothing up-to-date). Renderscript is still a thing in 2017, right?


Solution

  • The joy of android developpement. I found the solution! I simply had to change:

    minSdkVersion 19
    

    to:

    minSdkVersion 21
    

    to be honest, I have no idea how to explain this. If anyone has an explanation, that would be great!