Hi.
Great work on the new stable version of CameraX with CameraXViewFinder, I'm happy that I now can use the new viewfinder Composable in production code :)
However I'm having a general issue using CameraX with photo capture, it is sometimes giving me this exception:
09-11 10:18:42.241 10798 10798 E CameraDebug: Photo capture failed:
Failed to update Exif data 09-11 10:18:42.241 10798 10798 E CameraDebug: androidx.camera.core.ImageCaptureException: Failed to update Exif data
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.FileUtil.updateFileExif(FileUtil.java:119)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.JpegBytes2Disk.apply(JpegBytes2Disk.java:57)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.JpegBytes2Disk.apply(JpegBytes2Disk.java:46)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.ProcessingNode.saveJpegToDisk(ProcessingNode.java:326)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.ProcessingNode.processOnDiskCapture(ProcessingNode.java:286)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.ProcessingNode.processInputPacket(ProcessingNode.java:201)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.ProcessingNode.lambda$transform$0$androidx-camera-core-imagecapture-ProcessingNode(ProcessingNode.java:147)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.ProcessingNode$$ExternalSyntheticLambda7.run(D8$$SyntheticClass:0)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.lang.Thread.run(Thread.java:1119)
09-11 10:18:42.241 10798 10798 E CameraDebug: Caused by: java.io.IOException: Failed to copy original file to temp file
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.exifinterface.media.ExifInterface.saveAttributes(ExifInterface.java:4921)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.impl.utils.Exif.save(Exif.java:175)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.camera.core.imagecapture.FileUtil.updateFileExif(FileUtil.java:117)
09-11 10:18:42.241 10798 10798 E CameraDebug: ... 10 more
09-11 10:18:42.241 10798 10798 E CameraDebug: Caused by: java.io.IOException: No such file or directory
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.io.UnixFileSystem.createFileExclusively0(Native Method)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:368)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.io.File.createTempFile(File.java:2023)
09-11 10:18:42.241 10798 10798 E CameraDebug: at java.io.File.createTempFile(File.java:2069)
09-11 10:18:42.241 10798 10798 E CameraDebug: at androidx.exifinterface.media.ExifInterface.saveAttributes(ExifInterface.java:4908)
09-11 10:18:42.241 10798 10798 E CameraDebug: ... 12 more
I have seen it in version 1.5.0 in:
Samsung Galaxy A52s 5G
Samsung Galaxy S22 5G
I think I was testing on:
Sony Xperia 10 II
when it also happened, but I cleared logcat too quick unfortunately.
This was yesterday using 1.5.0-RC01.
I have a test-user where photo capture always fails, I have not got logs on it yet, but suspects it is the same issue.
That is on:
Samsung Galaxy Buddy 2
and it is also using the version 1.5.0-RC01
Do you know anything about this issue, and could it be something wrong in my project?
Let me know if you need any more information to help debug.
Some additional info:
- My app stores photos in app private internal folder (no storage permissions should be required?)
- I read some place that LocationManager was mentioned related to similar issue, my app uses LocationManager.
- As mentioned I have a photo issue always happening on Buddy 2, but on A52s and S22 I have only got the issue once so far.
- The app private folder where photos is stored is created at app launch, so I don't see any possibility that the folder is not existing during photo capture.
- Video capture works always
- TargetSdk is 35
- The different Android versions it has happened on is API 31, 34 and 35.