Unable to Build Android's HelloWorld in RenderScript

断了今生、忘了曾经 提交于 2019-12-25 01:40:14

问题


I am trying to build one of the RenderScript examples in the android/sdk/samples. I've tried HelloWorld and Balls examples, but the application is force closing


05-11 15:25:44.670: WARN/bcc(14985): Unable to open /data/data/com.android.rs.helloworld/cache/@com.android.rs.helloworld:raw@helloworld.oBCC in read mode.  (reason: No such file or directory)
05-11 15:25:44.670: ERROR/bcc(14985): Unable to readBC, bitcode=0x17d3f8, size=1068
05-11 15:25:44.670: DEBUG/StopWatch(14985): StopWatch bcc: PrepareExecutable time (us): 1551 
05-11 15:25:44.670: ERROR/RenderScript(14985): bcc: FAILS to prepare executable
05-11 15:25:44.670: DEBUG/RenderScript(14985): >>>> ~ScriptC  bccDisposeScript(0x17d8f0)
05-11 15:25:44.670: ERROR/RenderScript(14985): rsAssert failed: !mUserRefCount, in frameworks/base/libs/rs/rsObjectBase.cpp at 63
05-11 15:25:44.670: DEBUG/AndroidRuntime(14985): Shutting down VM
05-11 15:25:44.670: WARN/dalvikvm(14985): threadid=1: thread exiting with uncaught exception (group=0x4017e760)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985): FATAL EXCEPTION: main
05-11 15:25:44.680: ERROR/AndroidRuntime(14985): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.rs.helloworld/com.android.rs.helloworld.HelloWorld}: android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.os.Looper.loop(Looper.java:126)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread.main(ActivityThread.java:3997)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at java.lang.reflect.Method.invokeNative(Native Method)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at java.lang.reflect.Method.invoke(Method.java:491)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at dalvik.system.NativeStart.main(Native Method)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985): Caused by: android.renderscript.RSRuntimeException: Loading of ScriptC script failed.
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.renderscript.ScriptC.(ScriptC.java:60)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.ScriptC_helloworld.(ScriptC_helloworld.java:32)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.HelloWorldRS.initRS(HelloWorldRS.java:46)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.HelloWorldRS.init(HelloWorldRS.java:37)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.HelloWorldView.ensureRenderScript(HelloWorldView.java:44)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.HelloWorldView.(HelloWorldView.java:33)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at com.android.rs.helloworld.HelloWorld.onCreate(HelloWorld.java:33)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
05-11 15:25:44.680: ERROR/AndroidRuntime(14985):     ... 11 more
05-11 15:25:44.680: WARN/ActivityManager(130):   Force finishing activity com.android.rs.helloworld/.HelloWorld

I am attempting to build on the Xoom running 3.0.1. Can anyone please confirm if you are able to install a RenderScript example?

Thank you.


回答1:


There was an acknowledged problem with the compiler that prevented any of the samples from running. It was addressed here.

The workaround provided by the android team is to replace your platform-tools directory with the one from a previous release which uses the compiler from 3.0.

This fix worked for me.




回答2:


Hmmmm... This big yellow warning just popped up telling me this is not a discussion forum and I MUST ANSWER THE QUESTION! But since no one (including myself) really knows anything about Renderscript, I feel compelled to offer some assistance. And also because Google specifically points to StackOverflow as an Android resource. So apologies to the administrators!

Anyway, I've successfully run all the samples in Eclipse but NOT with the emulator. The emulator (at least on my machine) is hideously slow. I bought a Xoom and it's been pretty easy to get all the samples to run on it.

So if you're using Eclipse and an actual Xoom (not the emulator) then I suggest starting from scratch with a fresh Eclipse installation and a fresh Android SDK installation. And make sure you use the "New Android Project" to import the samples. There's a selection somewhere in the wizard that specifically addresses importing a sample.



来源:https://stackoverflow.com/questions/5971356/unable-to-build-androids-helloworld-in-renderscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!