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的scriptsicblur,我添加了renderscript.v8。jar(在android支持lib v8中)支持17个api,但它在这一行上崩溃(在api <17中,它在4.2或更高版本上运行良好):
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 ?
有人知道我该怎么处理吗?
2 个解决方案
#1
11
You'll need to tell Eclipse or Android Studio to use RenderScript support mode.
您需要告诉Eclipse或Android Studio使用RenderScript支持模式。
In Eclipse, edit your project.properties
file and add:
在Eclipse中,编辑您的项目。属性文件并添加:
renderscript.target=18 renderscript.support.mode=true
渲染脚本。目标= 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):
在Android Studio中,编辑您的构建。应用程序模块中的gradle文件,并将其添加到defaultConfig附件中(参见http://developer.android.com/guide/topics/renderscript/compute.html#ide-setup):
renderscriptTargetApi 18 renderscriptSupportModeEnabled true
renderscriptTargetApi 18 renderscriptSupportModeEnabled真实
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.
目标API级别必须是您可以使用的最大值。如果您的最小SDK级别较高,则忽略此值,而使用最小SDK值。
#2
1
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
有趣的是,即使是Android Renderscript例子也无法在模拟器中工作,我们可以用API 10来说明。(通过Android Studio测试,最近的更新,创建示例,使用API 10 ->崩溃的仿真器)。这是令人惊讶的。在我的项目中,我确实尝试了/捕获了Renderscript,并采取了一个后退至少不会崩溃的应用程序,如果一个愚蠢的模糊效果,用Renderscript做的,是不可用的。我们知道,设备上缺少共享库。这就是为什么有些人将Renderscript库复制到他们的项目中,通常构建工具也会这样做。可以通过查看apk/zip文件来轻松地检查这一点。我认为这里给出了一个很好的教程:http://emobile.com/2013/10/renderscript -for all。
#1
11
You'll need to tell Eclipse or Android Studio to use RenderScript support mode.
您需要告诉Eclipse或Android Studio使用RenderScript支持模式。
In Eclipse, edit your project.properties
file and add:
在Eclipse中,编辑您的项目。属性文件并添加:
renderscript.target=18 renderscript.support.mode=true
渲染脚本。目标= 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):
在Android Studio中,编辑您的构建。应用程序模块中的gradle文件,并将其添加到defaultConfig附件中(参见http://developer.android.com/guide/topics/renderscript/compute.html#ide-setup):
renderscriptTargetApi 18 renderscriptSupportModeEnabled true
renderscriptTargetApi 18 renderscriptSupportModeEnabled真实
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.
目标API级别必须是您可以使用的最大值。如果您的最小SDK级别较高,则忽略此值,而使用最小SDK值。
#2
1
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
有趣的是,即使是Android Renderscript例子也无法在模拟器中工作,我们可以用API 10来说明。(通过Android Studio测试,最近的更新,创建示例,使用API 10 ->崩溃的仿真器)。这是令人惊讶的。在我的项目中,我确实尝试了/捕获了Renderscript,并采取了一个后退至少不会崩溃的应用程序,如果一个愚蠢的模糊效果,用Renderscript做的,是不可用的。我们知道,设备上缺少共享库。这就是为什么有些人将Renderscript库复制到他们的项目中,通常构建工具也会这样做。可以通过查看apk/zip文件来轻松地检查这一点。我认为这里给出了一个很好的教程:http://emobile.com/2013/10/renderscript -for all。