问题描述
我只是想在我的应用程序中使用RenderScript的ScriptIntrinsicBlur,我已经添加了renderscript.v8.jar(在Android支持lib v8)支持17 apis下,但它崩溃在这一行(在api
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());
且异常输出为
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 ?
推荐答案
您需要告诉Eclipse或Android Studio才能使用RenderScript支持模式。
You'll need to tell Eclipse or Android Studio to use RenderScript support mode.
在Eclipse中,编辑 project.properties
文件并添加:
In Eclipse, edit your project.properties
file and add:
renderscript.target = 18
renderscript.support.mode = true
在Android Studio,在应用程序模块中编辑 build.gradle
文件,并将其添加到 defaultConfig
磁盘盒中(请参阅了解详情):
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
目标API级别需要有您可以使用的最大值。如果您的最低SDK级别较高,则会忽略此值,而改用最小SDK值。
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.
这篇关于android不能加载SupportV8 RenderScript在api< 17的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!