startPreview failed

1,834 views
Skip to first unread message

Filipe Batista

unread,
Apr 25, 2012, 10:40:57 AM4/25/12
to app...@googlegroups.com
Hi, 
I was testing appunta by doing a simple test app based on the sample that you have, but i always get ar error 
 java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)

I have the the camera permissions on the AndroidManifest.xml

Thanks
Best Regards

Sergi Martínez

unread,
Apr 25, 2012, 10:47:18 AM4/25/12
to app...@googlegroups.com
Hi Filipe

What Android version are you using in your project?

The CameraView provided only works on Android >=10.

That's because the support for turning the camera in previous versions was really and issue. If you need to compile for older versions, my advice is create your own CameraView without rotation enabled.

Regs


On Wed, Apr 25, 2012 at 4:40 PM, Filipe Batista <batista...@gmail.com> wrote:
doing a simple test app based on the sample that you have, but i always get ar error 
 java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native



Filipe Batista

unread,
Apr 25, 2012, 11:02:25 AM4/25/12
to app...@googlegroups.com
Hi,
My project version is Android 10 and i am also testing in smartphone with 2.3.3

I have now tested the sample application that you have and also does not work. Gives me the same error.


Quarta-feira, 25 de Abril de 2012 15:47:18 UTC+1, Sergi Martínez escreveu:
Hi Filipe

What Android version are you using in your project?

The CameraView provided only works on Android >=10.

That's because the support for turning the camera in previous versions was really and issue. If you need to compile for older versions, my advice is create your own CameraView without rotation enabled.

Regs

Sergi Martínez

unread,
Apr 25, 2012, 11:03:30 AM4/25/12
to app...@googlegroups.com
Interesting. Which phone model are you using?


On Wed, Apr 25, 2012 at 5:02 PM, Filipe Batista <batista...@gmail.com> wrote:
Android 10 and i am also testing in smartphone with 2.3.3

I have now tested the sample application that you have and a



Filipe Batista

unread,
Apr 25, 2012, 11:09:57 AM4/25/12
to app...@googlegroups.com
The phone is an LG p500.
The  interesting thing is that i have now installed the version that you have in Google Play and it works but the camera image is rotated 90º anti-clockwise. I think this problem of the camera rotation is a problem of the phone because in Wikitude i have the same problem.

The version in Google Play is the same that is in the sample folder?
Thanks

Quarta-feira, 25 de Abril de 2012 16:03:30 UTC+1, Sergi Martínez escreveu:
Interesting. Which phone model are you using?

Bernat

unread,
Apr 25, 2012, 11:10:16 AM4/25/12
to app...@googlegroups.com
Hi Sergi!

I'm the same issue trying appunta, te apk in google play works but doesn't show nothing (black screen with points)

But if i try myself, AR can't work :(

I'm using MIUI  and camera apk works.

!Thanks!

LG P970

Sergi Martínez

unread,
Apr 25, 2012, 11:31:00 AM4/25/12
to app...@googlegroups.com
HI

Both apps are the same, but probably different versions. The version in the market is not so updated.

Could you send me the error log? I'll check and let you know, but the camera is a real hell due to incompatibilities. 

regs


On Wed, Apr 25, 2012 at 5:10 PM, Bernat <berna...@gmail.com> wrote:
google play works but doesn't show nothing (black screen with points)

But if i try myself, AR can't work :(



Filipe Batista

unread,
Apr 25, 2012, 11:38:03 AM4/25/12
to app...@googlegroups.com
Error Log:

04-25 16:44:54.109: E/AndroidRuntime(8988): FATAL EXCEPTION: main
04-25 16:44:54.109: E/AndroidRuntime(8988): java.lang.RuntimeException: startPreview failed
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.hardware.Camera.startPreview(Native Method)
04-25 16:44:54.109: E/AndroidRuntime(8988): at com.appunta.android.ui.CameraView.surfaceCreated(CameraView.java:69)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.SurfaceView.updateWindow(SurfaceView.java:552)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:350)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.View.draw(View.java:6883)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.View.draw(View.java:6883)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-25 16:44:54.109: E/AndroidRuntime(8988): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1874)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewRoot.draw(ViewRoot.java:1524)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.view.ViewRoot.handleMessage(ViewRoot.java:1861)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.os.Handler.dispatchMessage(Handler.java:99)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.os.Looper.loop(Looper.java:123)
04-25 16:44:54.109: E/AndroidRuntime(8988): at android.app.ActivityThread.main(ActivityThread.java:3729)
04-25 16:44:54.109: E/AndroidRuntime(8988): at java.lang.reflect.Method.invokeNative(Native Method)
04-25 16:44:54.109: E/AndroidRuntime(8988): at java.lang.reflect.Method.invoke(Method.java:507)
04-25 16:44:54.109: E/AndroidRuntime(8988): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
04-25 16:44:54.109: E/AndroidRuntime(8988): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:632)
04-25 16:44:54.109: E/AndroidRuntime(8988): at dalvik.system.NativeStart.main(Native Method)


Quarta-feira, 25 de Abril de 2012 16:31:00 UTC+1, Sergi Martínez escreveu:
HI

Both apps are the same, but probably different versions. The version in the market is not so updated.

Could you send me the error log? I'll check and let you know, but the camera is a real hell due to incompatibilities. 

regs

Sergi Martínez

unread,
Apr 25, 2012, 11:49:23 AM4/25/12
to app...@googlegroups.com
Thanks, I'll check it and let you know.


On Wed, Apr 25, 2012 at 5:38 PM, Filipe Batista <batista...@gmail.com> wrote:
at android.hardware.Camera.startPreview(Native Method)
04-25 16:44:54.109: E/AndroidRuntime(8988): at com.appunta



Sergi Martínez

unread,
May 2, 2012, 11:51:25 AM5/2/12
to app...@googlegroups.com
There is some discussion on the camera list. Maybe you should check this:


The problem is that pre2.3 versions have very lousy implementations of the camera rotation. My conclusion is that you can't ensure correct rotation for these versions.

I'll vote for making a non-rotable component for pre2.3 and a rotable one for later versions.

Reply all
Reply to author
Forward
0 new messages