Android Renderscript 示例强制关闭
我找到了这个链接,我想尝试一下轮播示例。我将所有类和 rs 文件(来自轮播示例的所有内容)复制到我自己的项目中,并尝试在实际设备(摩托罗拉 xoom)上构建它。但我一直在强行关闭。 logcat 中的错误是:
11-01 11:37:23.490: E/RenderScript(927): 0x17c718, couldn't find an EGLConfig matching
the screen format
11-01 12:09:53.320: E/AndroidRuntime(1214): FATAL EXCEPTION: main
11-01 12:09:53.320: E/AndroidRuntime(1214): java.lang.RuntimeException: Unable to
start activity ComponentInfo{com.android.example/com.android.example.CarouselActivity}:
java.lang.NullPointerException
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.access$1500(ActivityThread.java:122)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.os.Handler.dispatchMessage(Handler.java:99)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.os.Looper.loop(Looper.java:132)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.main(ActivityThread.java:4025)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
java.lang.reflect.Method.invokeNative(Native Method)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
java.lang.reflect.Method.invoke(Method.java:491)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
dalvik.system.NativeStart.main(Native Method)
11-01 12:09:53.320: E/AndroidRuntime(1214): Caused by: java.lang.NullPointerException
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.elementFromBitmap(Allocation.java:821)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.typeFromBitmap(Allocation.java:839)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.createFromBitmap(Allocation.java:864)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.createFromBitmapResource(Allocation.java:1074)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.loadImages(CarouselRS.java:127)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.initRS(CarouselRS.java:188)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.init(CarouselRS.java:36)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselView.ensureRenderScript(CarouselView.java:25)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselView.<init>(CarouselView.java:13)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselActivity.onCreate(CarouselActivity.java:15)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
11-01 12:09:53.320: E/AndroidRuntime(1214): ... 11 more
我不知道这意味着什么以及应该如何解决这个问题。有人有这样的问题吗?
I found this link and I wanted to try the carousel example out. I copied all the classes and rs file (all that there was from the carousel example) into my own project and I tried building it on an actual device (Motorola xoom). But I keep getting force closes. The error in the logcat is:
11-01 11:37:23.490: E/RenderScript(927): 0x17c718, couldn't find an EGLConfig matching
the screen format
11-01 12:09:53.320: E/AndroidRuntime(1214): FATAL EXCEPTION: main
11-01 12:09:53.320: E/AndroidRuntime(1214): java.lang.RuntimeException: Unable to
start activity ComponentInfo{com.android.example/com.android.example.CarouselActivity}:
java.lang.NullPointerException
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.access$1500(ActivityThread.java:122)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.os.Handler.dispatchMessage(Handler.java:99)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.os.Looper.loop(Looper.java:132)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.main(ActivityThread.java:4025)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
java.lang.reflect.Method.invokeNative(Native Method)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
java.lang.reflect.Method.invoke(Method.java:491)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
dalvik.system.NativeStart.main(Native Method)
11-01 12:09:53.320: E/AndroidRuntime(1214): Caused by: java.lang.NullPointerException
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.elementFromBitmap(Allocation.java:821)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.typeFromBitmap(Allocation.java:839)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.createFromBitmap(Allocation.java:864)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.renderscript.Allocation.createFromBitmapResource(Allocation.java:1074)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.loadImages(CarouselRS.java:127)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.initRS(CarouselRS.java:188)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselRS.init(CarouselRS.java:36)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselView.ensureRenderScript(CarouselView.java:25)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselView.<init>(CarouselView.java:13)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
com.android.example.CarouselActivity.onCreate(CarouselActivity.java:15)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
11-01 12:09:53.320: E/AndroidRuntime(1214): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
11-01 12:09:53.320: E/AndroidRuntime(1214): ... 11 more
I don't know what this means and how I should fix this. Does anyone have this kind of problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如帖子中所说,我在实际设备上运行它,而不是模拟器。问题是这个链接,但他们在 Android 中解决了这个问题sdk tools revision 15。所以下载新版本的sdk tools,应该就可以了。
As said in the post, I run it on actual device, not the emulator. the problem was this link, but they removed the problem in android sdk tools revision 15. So download the new version of sdk tools, and it should be just fine.
我不知道摩托罗拉xoom,它w。但通常由于 root 方法有一个参数,我会遇到编译时错误。删除“int root() {”的参数,它应该可以工作。
另一件事:它们不适用于模拟器,因为模拟器支持尚不存在。
I dont know about motorola xoom,it w . But usually i get compile time errors due to root method which has an argument . Remove the argument to "int root() {" and it should work.
One more thing : They dont work on emulators because emulator support is not yet there.
是的。 Renderscript 无法在模拟器上运行。在具有 android 3.0 或更高版本的设备上运行相同的操作。
Yes. Renderscript wont work on emulator. Run the same on the device which has android 3.0 or later.