If your issue is related to observed behavior, rather than API usage, please include information about the specific device (even if the device is an emulator).
Questions tagged [android-camerax]
807 questions
5
votes
2 answers
How do I lock/freeze a CameraX preview TextureView?
I'm following the CameraX code lab and also looked at their sample app and source code in Android Studio, but there doesn't seem to be a way to freeze or lock the TextureView that is showing the preview frames.
In the Camera2 API we can just call…

Chee-Yi
- 880
- 10
- 17
4
votes
1 answer
connecting USB UVC camera with CameraX
I'm trying to make an android app that preview a stream from an external USB camera.
I can see the camera using UsbManager but for some reason, the CameraX doesn't list it in the connected camera list.
Does anyone have an idea how to fix this?
Also,…

IdH
- 41
- 4
4
votes
0 answers
CameraX TimeoutException Cannot complete surfaceList
I am going through the CameraX tutorial at Android Developers https://developer.android.com/codelabs/camerax-getting-started#3 using version 1.1.0 of the library. The logs look good at first, but later a TimeoutException is raised and the camera…

m_OO_m
- 55
- 7
4
votes
1 answer
How to scale the camera preview to any given dimensions or shapes in a translucent background using Jetpack Compose
I have a dialog fragment with a translucent background. I want to place a camera preview on this dialog fragment either in the shape of a circle or a square.
On setting the scale type as PreviewView.ScaleType.FIT_CENTER, the preview is as…

Hakshay
- 64
- 3
4
votes
1 answer
How to crop image captured by CameraX based on a rectangle on Preview display
Hello I am new to android development, can anyone help me to crop the image captured by CameraX based on a rectangle on PreviewView?
This is the activity_main.xml:

of32 inc
- 105
- 1
- 7
4
votes
1 answer
Android CameraX NoSuchMethodError: No static method getOrCreateInstance(Landroid/content/Context;)
I run Android emulator and crash at "cameraProviderFuture = ProcessCameraProvider.getInstance(requireActivity())"
this line.
Why?
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view,…

Squall Huang
- 647
- 9
- 20
4
votes
2 answers
How to create Bitmap from Android MediaImage in OUTPUT_IMAGE_FORMAT_RGBA_8888 format?
I am trying to use this new feature of CameraX Image Analysis (version 1.1.0-alpha08): using setOutputImageFormat(ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888), images sent to the analyzer will have RGBA format.
See this for reference:…

MickaelD
- 161
- 7
4
votes
1 answer
Reduce video file size using camera x android
I am recording the video using camera x in my android app. I have successfully reduced the resolution of the video using:
videoCapture = new VideoCapture.Builder()
.setCameraSelector(cameraSelector)
.setTargetResolution(new…

Usama Shakeel
- 69
- 8
4
votes
1 answer
How to most efficiently use and apply Android CameraX Image Analysis setTargetRotation
Similar to what is laid out in the tutorial I am initializing CameraX's Image Analysis use case with code:
ImageAnalysis imageAnalysis =
new ImageAnalysis.Builder()
.setTargetResolution(new Size(1280, 720))
…

topher217
- 1,188
- 12
- 35
4
votes
0 answers
Save image to a specific folder using Camera X ImageCapture.OutputFileOptions.Builder below android 29
I am trying to implement Camera X app. The problem i am facing right now is i am not able to figure out how to save image below to a specific folder using ImageCapture.OutputFileOptions.Builder
My current code is below. Do i need to adopt some other…

Malik Bilal
- 869
- 8
- 25
4
votes
2 answers
Set width and height of ImageAnalyzer and PreviewView the same
I've got a simple setup:
preview = new Preview.Builder().build();
preview.setSurfaceProvider(mPreviewView.createSurfaceProvider());
imageAnalysis = new ImageAnalysis.Builder().setTargetResolution(new…

Nummer Eins
- 199
- 1
- 8
4
votes
4 answers
How to use CameraX without XML and PreviewView in service or Receiver?
I want to take photo with CameraX in service without any xml and PreviewView or something else for showing picture, But I have problem.

Amin Majlesi
- 91
- 5
4
votes
0 answers
Capture android camera output with overlay animation
I want to overlay a shape animation on Camera2/CameraX preview using a custom surfaceview and capture and save the video including both camera output and overlay animation.
I was able to just save a camera output using…

Patola
- 515
- 8
- 30
4
votes
1 answer
Bridging Android CameraX into React Native
I am creating a native UI component for CameraX to React Native. First tried triggering in activity to check and worked fine. Looking out to extract as UI View for React Native. Its just showing a blank white screen.
camera preview is not showing…

Balasubramanian
- 5,274
- 6
- 33
- 62
4
votes
1 answer
Cannot save captured image to external media directory using CameraX
I was following this code labs example Link on how to use CameraX API on Android, however when I tried to capture and save the image to the external media directory that is created in Oncreate method in the main activity I get an error message…

Mason
- 51
- 1
- 4