Try this:

http://www.hitziger.net/blog/android-camera-autofocus-failed/

Your surface might be created milliseconds after your first auto focus 
request.


On Tuesday, 20 March 2012 18:12:08 UTC, Linda Zhang wrote:
>
> Was a solution to this problem ever found? I am running into the same 
> issue, but only on 4.0 devices. On pre-ICS devices my code runs fine. 
>
> On Jan 30, 1:21 am, Marcin Mikosik <[email protected]> wrote: 
> > Hi, 
> > 
> > I received a few crash reports through developer console that shows 
> > RuntimeException thrown from Camera.autoFocus() method. 
> > As javadocs does not mention that any exception can be thrown from this 
> > code I wonder what this exception mean and how one can workaround it. 
> > Can anyone help on that? 
> > thanks 
> > 
> > stack trace below 
> > 
> > java.lang.RuntimeException: autoFocus failed 
> > at android.hardware.Camera.native_autoFocus(Native Method) 
> > at android.hardware.Camera.autoFocus(Camera.java:832) 
> > at aY.g(Unknown Source) 
> > at bm.surfaceChanged(Unknown Source) 
> > at android.view.SurfaceView.updateWindow(SurfaceView.java:568) 
> > at android.view.SurfaceView.setFrame(SurfaceView.java:320) 
> > at android.view.View.layout(View.java:11174) 
> > at android.widget.FrameLayout.onLayout(FrameLayout.java:431) 
> > at android.view.View.layout(View.java:11180) 
> > at android.view.ViewGroup.layout(ViewGroup.java:4203) 
> > at android.widget.FrameLayout.onLayout(FrameLayout.java:431) 
> > at android.view.View.layout(View.java:11180) 
> > at android.view.ViewGroup.layout(ViewGroup.java:4203) 
> > at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628) 
> > at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486) 
> > at android.widget.LinearLayout.onLayout(LinearLayout.java:1399) 
> > at android.view.View.layout(View.java:11180) 
> > at android.view.ViewGroup.layout(ViewGroup.java:4203) 
> > at android.widget.FrameLayout.onLayout(FrameLayout.java:431) 
> > at android.view.View.layout(View.java:11180) 
> > at android.view.ViewGroup.layout(ViewGroup.java:4203) 
> > at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1468) 
> > at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418) 
> > at android.os.Handler.dispatchMessage(Handler.java:99) 
> > at android.os.Looper.loop(Looper.java:137) 
> > at android.app.ActivityThread.main(ActivityThread.java:4340) 
> > at java.lang.reflect.Method.invokeNative(Native Method) 
> > at java.lang.reflect.Method.invoke(Method.java:511) 
> > at 
> > 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 
> 784) 
> > at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
> > at dalvik.system.NativeStart.main(Native Method) 
> > 
> > --http://developing-android-games.perunlabs.com/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to