Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

crash - android can't load SupportV8 RenderScript in api <17

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...