Sample code in CameraX CodeLabs does not work with CameraX versions alpha09&10

531 views
Skip to first unread message

Vadim Rebro

unread,
Feb 10, 2020, 3:58:43 PM2/10/20
to Android CameraX Discussion Group
Actually the sample code at https://codelabs.developers.google.com/codelabs/camerax-getting-started works for camerax_version = '1.0.0-alpha06'
But if you use alpha09 then this code won't work:

 val previewConfig = PreviewConfig.Builder().apply {...

You need to call Preview.Builder method instead.

Another thing is that Preview no longer contains setOnPreviewOutputUpdateListener and you need to do something with this:
preview.setOnPreviewOutputUpdateListener {...

So, I was unable to run the code from that page for CameraX alpha09 but it worked for code samples from https://developer.android.com/training/camerax/preview?hl=en (after I found and fixed a couple of bugs there).


https://codelabs.developers.google.com/codelabs/camerax-getting-started

Oscar Wahltinez‎

unread,
Feb 10, 2020, 4:10:04 PM2/10/20
to Vadim Rebro, Android CameraX Discussion Group
Hi Vadim,

Thank you for flagging this. We will update the codelab shortly after the beta version of CameraX becomes available. In the meantime, you can use the official sample for reference: g.co/camerax/sample

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/47fcc248-dffd-487a-a600-bd9894470660%40android.com.

Salvatore Testa

unread,
Feb 10, 2020, 6:31:23 PM2/10/20
to Oscar Wahltinez‎, Vadim Rebro, Android CameraX Discussion Group

I also ran into an issue with the official sample. It looks like the androidx.camera.core.ImageCapture#takePicture(androidx.camera.core.ImageCapture.OutputFileOptions, java.util.concurrent.Executor, androidx.camera.core.ImageCapture.OnImageSavedCallback) method doesn’t work like it should.

https://issuetracker.google.com/issues/149241379


Vadim Rebro

unread,
Feb 10, 2020, 10:20:49 PM2/10/20
to Android CameraX Discussion Group, rebro...@gmail.com
No problem! Looking forward to CameraX stable release!


On Monday, February 10, 2020 at 4:10:04 PM UTC-5, Oscar Wahltinez‎ wrote:
Hi Vadim,

Thank you for flagging this. We will update the codelab shortly after the beta version of CameraX becomes available. In the meantime, you can use the official sample for reference: g.co/camerax/sample

On Mon, Feb 10, 2020, 12:58 Vadim Rebro <rebro...@gmail.com> wrote:
Actually the sample code at https://codelabs.developers.google.com/codelabs/camerax-getting-started works for camerax_version = '1.0.0-alpha06'
But if you use alpha09 then this code won't work:

 val previewConfig = PreviewConfig.Builder().apply {...

You need to call Preview.Builder method instead.

Another thing is that Preview no longer contains setOnPreviewOutputUpdateListener and you need to do something with this:
preview.setOnPreviewOutputUpdateListener {...

So, I was unable to run the code from that page for CameraX alpha09 but it worked for code samples from https://developer.android.com/training/camerax/preview?hl=en (after I found and fixed a couple of bugs there).


https://codelabs.developers.google.com/codelabs/camerax-getting-started

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-developers+unsub...@android.com.
Reply all
Reply to author
Forward
0 new messages