Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Yes. Renderscript wont work on emulator. Run the same on the device which has android 3.0 or later.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top