RuntimeException: autoFocus failed
Hi
I got about 50 crashes(10 peoples) from Android 5.1.1 (Galaxy J3(2016))
Fatal Exception: java.lang.RuntimeException: autoFocus failed
at android.hardware.Camera.native_autoFocus(Camera.java)
at android.hardware.Camera.autoFocus(Camera.java:1331)
at com.pedro.encoder.input.video.a$1.run(SourceFile:149)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
Your library version: 1.2.5
What can be a problem?
Do you know if this is second time that open camera or first time? Also make sure you have this permissions:
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera2.full" />
<uses-feature android:name="android.hardware.camera2.autofocus" />
The second feature is not setted in the manifest example but maybe solve the problem. If the problem persist, If you can, share me the mobile model error list to reproduce it and debug. The last fix idea is do a catch but you will lose autofocus in that devices if crash (I really don't want do it).
No i don't know, I see this error only in Crashlytics. I can't reproduce this. It looks like the problem really only affects one phone model Galaxy J3(2016) .

In manifest I have only
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
but I don't think that's the problem. Maybe I will block it from the code for this phone model. In my app, video streaming is only a small part and I can do it.
I reproduced the error forcing focus mode auto on nexus 5. (I got the same error that you): https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/encoder/src/main/java/com/pedro/encoder/input/video/Camera1ApiManager.java#L147 The problem is now fixed: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/commit/9ea25f9c79912db0b0501768de695f047277cb93 You can upgrade the version to 1.2.6
thx it's work