首先让我说我的所有SDK包都是22.3版本的最新版本,包括Ecplise ADT和Build-Tools 19.0.0.
我的目的是在各种AndroID平台上实现一些高计算图像算法,可能从API 8开始.为此,我在我的Ecplise项目中设置了对renderscript-v8库的引用,同时将应用程序定位到API 19.
我有两个AndroID设备要测试,第一个是AndroID 4.3(API 18),第二个是AndroID 2.2(API 8).我在运行这段代码时遇到了不同的异常,它调用了ScriptIntrinsicYuvToRGB(代码部分取自Executing ScriptIntrinsicYuvToRgb问题):
/* -------------- global vars */private RenderScript rs;private ScriptIntrinsicYuvToRGB rs_YUVtoRGB;private Allocation rs_YUVtoRGB_in;private Allocation rs_YUVtoRGB_out; /* --------------in constructor... */this.rs = RenderScript.create(this.getContext());this.rs_YUVtoRGB = ScriptIntrinsicYuvToRGB.create(this.rs,Element.U8_4(rs));Type.Builder tb_in = new Type.Builder(this.rs,Element.createPixel(this.rs,Element.DataType.UNSIGNED_8,Element.DataKind.PIXEL_YUV));tb_in.setX(prevWIDth);tb_in.setY(prevHeight);tb_in.setMipmaps(false);tb_in.setYuvFormat(this.camera.getParameters().getPrevIEwFormat());this.rs_YUVtoRGB_in = Allocation.createTyped(this.rs,tb_in.create(),Allocation.USAGE_SCRIPT);Type.Builder tb_out = new Type.Builder(this.rs,Element.RGBA_8888(this.rs));tb_out.setX(prevWIDth);tb_out.setY(prevHeight);tb_out.setMipmaps(false);this.rs_YUVtoRGB_out = Allocation.createTyped (this.rs,tb_out.create(),Allocation.USAGE_SCRIPT);/* --------------launching the script... */// byte[] raw... // a YUV imagethis.rs_YUVtoRGB_in.copyFrom(raw);this.rs_YUVtoRGB.setinput(this.rs_YUVtoRGB_in);this.rs_YUVtoRGB.forEach(this.rs_YUVtoRGB_out);int[] framePixels = new int[prevIEwSize.wIDth * prevIEwSize.height];this.rs_YUVtoRGB_out.copyTo(framePixels); // final RGB converted image
Eclipse设法编译它(它应该意味着库被很好地引用),但……
AndroID 4.3失败于:Type.Builder tb_in = new Type.Builder(this.rs,Element.DataKind.PIXEL_YUV));使用不受支持的DataKind
11-24 11:17:57.685: E/AndroIDRuntime(2494): FATAL EXCEPTION: main11-24 11:17:57.685: E/AndroIDRuntime(2494): androID.renderscript.RSIllegalArgumentException: Unsupported DataKind11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.renderscript.Element.createPixel(Element.java:911)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.support.v8.renderscript.ElementThunker.createPixel(ElementThunker.java:224)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.support.v8.renderscript.Element.createPixel(Element.java:832)11-24 11:17:57.685: E/AndroIDRuntime(2494): at com.lag.appprj.CameraPrevIEw.setupCamera(CameraPrevIEw.java:167)11-24 11:17:57.685: E/AndroIDRuntime(2494): at com.lag.appprj.CameraPrevIEw.surfaceCreated(CameraPrevIEw.java:86)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.SurfaceVIEw.updateWindow(SurfaceVIEw.java:571)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.SurfaceVIEw.access11-24 11:45:45.329: E/AndroIDRuntime(2048): FATAL EXCEPTION: main11-24 11:45:45.329: E/AndroIDRuntime(2048): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lag.appprj/com.lag.appprj.CaptureActivity}: androID.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfIEdlinkError: library RSSupport not found11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2663)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread.access00(ActivityThread.java:125)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.os.Handler.dispatchMessage(Handler.java:99)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.os.Looper.loop(Looper.java:123)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread.main(ActivityThread.java:4627)11-24 11:45:45.329: E/AndroIDRuntime(2048): at java.lang.reflect.Method.invokeNative(Native Method)11-24 11:45:45.329: E/AndroIDRuntime(2048): at java.lang.reflect.Method.invoke(Method.java:521)11-24 11:45:45.329: E/AndroIDRuntime(2048): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)11-24 11:45:45.329: E/AndroIDRuntime(2048): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:618)11-24 11:45:45.329: E/AndroIDRuntime(2048): at dalvik.system.NativeStart.main(Native Method)11-24 11:45:45.329: E/AndroIDRuntime(2048): Caused by: androID.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfIEdlinkError: library RSSupport not found11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.support.v8.renderscript.RenderScript.create(RenderScript.java:945)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.support.v8.renderscript.RenderScript.create(RenderScript.java:982)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.support.v8.renderscript.RenderScript.create(RenderScript.java:968)11-24 11:45:45.329: E/AndroIDRuntime(2048): at com.lag.appprj.CameraPrevIEw.<init>(CameraPrevIEw.java:80)11-24 11:45:45.329: E/AndroIDRuntime(2048): at com.lag.appprj.CaptureActivity.onCreate(CaptureActivity.java:34)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)11-24 11:45:45.329: E/AndroIDRuntime(2048): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2627)0(SurfaceVIEw.java:86)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.SurfaceVIEw.onPreDraw(SurfaceVIEw.java:175)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.VIEwTreeObserver.dispatchOnPreDraw(VIEwTreeObserver.java:833)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1860)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:1004)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:5481)11-24 11:17:57.685: E/AndroIDRuntime(2494): at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java:749)
在AndroID 2.2上,它在init阶段失败:加载RS jni库时出错:java.lang.UnsatisfIEdlinkError:找不到库RSSupport
谢谢您的帮助
解决方法 createPixel()的错误是ElementThunker.java中的实际错误.它缺少PIXEL_YUV的情况,因此最终返回null而不是相应的类型.我将在AOSP和未来的SDK版本中修复此问题. (补丁是在 https://android-review.googlesource.com/70810).至于库加载问题,我相信你的另一个问题,你注意到你的Application.mk文件没有为所有架构构建(因此没有捆绑适当的共享库).它在4.3上工作的原因是4.3自动拥有libRSSupport.so的副本(虽然它确实不应该).较旧的设备显然没有.so的默认/ system / lib /副本,因此除非你的构建实际上用apk打包它,否则它们总是无法加载它.
总结以上是内存溢出为你收集整理的android – 使用Renderscript支持库为不同平台获取不同的错误全部内容,希望文章能够帮你解决android – 使用Renderscript支持库为不同平台获取不同的错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)