是Renderscript在同一个项目中NDK库不兼容? [英] Is Renderscript incompatible with NDK libraries in the same project?

查看:237
本文介绍了是Renderscript在同一个项目中NDK库不兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个Android应用程序,使得使用NDK有两种生成和Renderscript本土code的一个问题。

I have a problem creating an Android app that makes use of both Renderscript and native code generated with NDK.

实质上,我使用NDK的工具来生成一个名为库 sprstr_native.so 。我设法打电话给他们的C ++通过Java code函数没有问题。然后,我需要一些Renderscript的功能(尤其是 ScriptIntrinsicYuvToRGB ),所以我已经添加到我的Eclipse项目的相对支持库的引用, renderscript- v8.jar ,和这条线在项目属性文件:

Substantially, I use NDK tools to generate a library called sprstr_native.so. I managed to call their C++ functions through Java code without problems. Then I needed some Renderscript functionalities (in particular, ScriptIntrinsicYuvToRGB) so I've added to my Eclipse project a reference to the relative support library, renderscript-v8.jar, and this line in the project properties file:

renderscript.support.mode=true

现在的问题:Android的不能识别我的 sprstr_native 再和调用code当应用程序崩溃:

Now the problem: Android can't recognize my sprstr_native anymore and the app crashes when calling the code:

System.loadLibrary("sprstr_native");

这是堆栈:

11-23 17:46:54.450: E/AndroidRuntime(3901): FATAL EXCEPTION: main
11-23 17:46:54.450: E/AndroidRuntime(3901): java.lang.ExceptionInInitializerError
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.Class.newInstanceImpl(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.Class.newInstance(Class.java:1409)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.os.Looper.loop(Looper.java:130)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at android.app.ActivityThread.main(ActivityThread.java:3683)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.reflect.Method.invokeNative(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.reflect.Method.invoke(Method.java:507)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at dalvik.system.NativeStart.main(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sprstr_native: findLibrary returned null
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.Runtime.loadLibrary(Runtime.java:429)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at java.lang.System.loadLibrary(System.java:554)
11-23 17:46:54.450: E/AndroidRuntime(3901):     at com.lag.proj.MainActivity.<clinit>(MainActivity.java:18)
11-23 17:46:54.450: E/AndroidRuntime(3901):     ... 15 more

奇怪的是,如果我删除所有引用到renderScript的本地库轮流工作再次
请不要告诉我,有Renderscript和NDK之间的不兼容code!

Curiously, if I delete all the references to Renderscript the native lib turns to work again! Please don't tell me that there are incompatibilities between Renderscript and NDK code!

推荐答案

我可能已经解决了它,但不能没有后来有了其他错误(见<一href=\"http://stackoverflow.com/questions/20173680/getting-different-errors-for-different-platforms-using-renderscript-support-libr\">Getting不同的错误使用Renderscript支持库)不同的平台。顺便说一句,该库加载阶段应通过增加对 Application.mk 文件这一行来解决:

I've probably solved it, but not without other errors that came after (see Getting different errors for different platforms using Renderscript Support Library). By the way, the library loading phase should be solved by adding this line on the Application.mk file:

APP_ABI := all

这让NDK编译OBJ文件对所有支持的体系结构。

That lets the NDK to compile the objs for all the supported architectures.

这篇关于是Renderscript在同一个项目中NDK库不兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆