android can't load SupportV8 RenderScript in api <17

Diako picture Diako · Aug 1, 2014 · Viewed 8.3k times · Source

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 ?

Answer

Larry Schiefer picture Larry Schiefer · Aug 2, 2014

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.