AR camera freezes on application launch: StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@d2addf1
When I launch any AR app, my camera freezes and the application stops executing. This is occuring both in my personal project and in an official Unity sample: https://github.com/Unity-Technologies/arfoundation-samples/issues/1136
Furthermore, I think the crash started occuring after a recent Android security update, so it might be related to Android rather than Unity.
I think it's the same problem as described in this thread: https://forum.unity.com/threads/ar-foundation-stopped-working-all-of-a-sudden-on-android.1529341/
Note: I confirmed that execution stops by printing a message on every frame. The application gets stuck on frame 15 or so. In other words, I can confirm that the application launches correctly, but it's running into some problem with the camera and it ends up crashing.
Device: OnePlus Nord N200 5G Android version 12, security update Dec 5 2023
Logcat:
2023-12-23 23:10:02.479 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.505 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.549 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.573 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.610 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.643 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.676 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:02.715 947 1248 Error cye Skipped image because max (16) images have been acquired from ImageReader.
2023-12-23 23:10:03.724 947 1236 Error RepeatCaptureReq(0) Capture failed.
2023-12-23 23:10:03.726 947 1294 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@d2addf1.
2023-12-23 23:10:04.730 947 1236 Error RepeatCaptureReq(0) Capture failed.
2023-12-23 23:10:04.735 947 1294 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@4461dd6.
2023-12-23 23:10:05.732 947 1236 Error RepeatCaptureReq(0) Capture failed.
2023-12-23 23:10:05.736 947 1294 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@8761857.
2023-12-23 23:10:06.365 947 1291 Error native E0000 00:00:1703391006.365528 1291 feature_tracks_and_imu_sync.cc:78] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:06.374 947 1291 Error native E0000 00:00:1703391006.374209 1291 data_synchronizer.cc:98] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:06.374 947 1291 Error native E0000 00:00:1703391006.374476 1291 data_synchronizer.cc:122] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:06.734 947 1236 Error RepeatCaptureReq(0) Capture failed.
2023-12-23 23:10:06.738 947 1294 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@ffd0f44.
2023-12-23 23:10:06.846 947 1291 Error native E0000 00:00:1703391006.846036 1291 feature_tracks_and_imu_sync.cc:78] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:06.855 947 1291 Error native E0000 00:00:1703391006.854984 1291 data_synchronizer.cc:98] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:06.855 947 1291 Error native E0000 00:00:1703391006.855245 1291 data_synchronizer.cc:122] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:07.327 947 1291 Error native E0000 00:00:1703391007.327019 1291 feature_tracks_and_imu_sync.cc:78] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:07.336 947 1291 Error native E0000 00:00:1703391007.336020 1291 data_synchronizer.cc:98] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
2023-12-23 23:10:07.337 947 1291 Error native E0000 00:00:1703391007.337274 1291 data_synchronizer.cc:122] IMU buffer beyond maximum size: 500 vs 500. Removing the first 1 element(s).
Uninstall and reinstall google play for ar services App
Solved!
Thank you very much for the tip, I confirm this, it does solve the problem, but only temporarily, and it does not even take a new build to break it again, just a reinstall of the affected app.
In my case reinstalling Google Play Services for AR makes my app work again (both new builds or the app submitted to the store 3 months ago), but if I uninstall my app and reinstall it again (same version, a new one, an old one, doesn't matter) then it breaks again.
Fortunately, until a final fix from Google, doing the reinstall of the "Google Play Services for AR" trick at least allows development to progress, but in no way is it a fix for production, and since many Play Store apps may be affected retroactively without even noticing, I guess this will become a priority very fast, at least it should.
This is related to https://github.com/google-ar/arcore-android-sdk/issues/1634 -- a server push was sent out to everybody to fix this problem; let me know if you're still seeing this.