Question

i just want to use RenderScript's ScriptIntrinsicBlur in my application , i've added renderscript.v8.jar (in android support lib v8) for supporting under 17 apis but it crashes on this line (in api <17 this happens it works fine on 4.2 or higher) :

        RenderScript rs = RenderScript.create(getApplicationContext());

and the Exception output is

 java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:299)
        at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
        at java.util.concurrent.FutureTask.run(FutureTask.java:137)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
        at java.lang.Thread.run(Thread.java:856)
 Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Couldn't load RSSupport: findLibrary returned null
        at android.support.v8.renderscript.RenderScript.create(RenderScript.java:945)
        at android.support.v8.renderscript.RenderScript.create(RenderScript.java:982)
        at android.support.v8.renderscript.RenderScript.create(RenderScript.java:968)

anyone has any idea how can i handle this ?

Was it helpful?

Solution

You'll need to tell Eclipse or Android Studio to use RenderScript support mode.

In Eclipse, edit your project.properties file and add:

renderscript.target=18 renderscript.support.mode=true

In Android Studio, edit your build.gradle file in your app module and add this in the defaultConfig enclosure (see http://developer.android.com/guide/topics/renderscript/compute.html#ide-setup for details):

renderscriptTargetApi 18 renderscriptSupportModeEnabled true

The target API level there needs to be the max you can use. If your minimum SDK level is higher, this value is ignored and the min SDK value is used instead.

OTHER TIPS

It's interesting, that even the Android Renderscript examples wont work in an emulator, lets say with API 10. (Tested via Android Studio, recent updates, create Example, Emulator with API 10 -> Crash). That's surprising. At my project, I did try/catch the Renderscript and take a fallback to at least do not crash the app, if the single stupid blur effect, made with Renderscript, is not available. So we know, the shared library is missing on the device. That's why some people copy the Renderscript libraries to their project, usually the build tools would do the same. One could easily check this by having a look into the apk/zip file. I think a good tutorial is given here: http://possiblemobile.com/2013/10/renderscript-for-all

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top