RC03 gives "error retrieving camcorder profile params" at creating CameraController

252 views
Skip to first unread message

Peter Varga

unread,
Feb 28, 2021, 2:08:01 PM2/28/21
to Android CameraX Discussion Group
Hi,

I use CameraController that worked well in RC02.
But if I upgrade to RC03 I get "androidx.camera.core.initializationexception: java.lang.runtimeexception: error retrieving camcorder profile params" when I create the CameraController. Simply when I attach the listener I get this exception:

cameraController = new LifecycleCameraController(context);
Futures.addCallback(cameraController.getInitializationFuture(), new FutureCallback<Void>() {
@Override
public void onFailure(Throwable t) {
 is called instead of onSuccess.

I run the app on a Samsung Note10 Plus. It worked well with rc02 and fails with rc03 without any modification.

Could you advise?
Thanks in advance,
Peter

Android CameraX Discussion Group

unread,
Mar 1, 2021, 5:50:27 PM3/1/21
to Android CameraX Discussion Group, varga.pet...@gmail.com
Hello Peter,

Thanks for writing in to the developer list. After chatting about this issue with the development team, I've gone ahead and created an issue at http://issuetracker.google.com/181599852.

We could use your help in providing some additional information:
  • Code samples
  • Are you using the Video function at all?
  • expanded error log
  • Other artifacts you're also using
Thanks!

teddy boy

unread,
Mar 2, 2021, 4:28:27 AM3/2/21
to Android CameraX Discussion Group, Android CameraX Discussion Group, varga.pet...@gmail.com
I had the same problem with rc03. I didn't use the video function only take photo. This issue happened most on Android 11.

```
Caused by java.lang.RuntimeException: Error retrieving camcorder profile params
       at android.media.CamcorderProfile.native_get_camcorder_profile(CamcorderProfile.java)
       at android.media.CamcorderProfile.get(CamcorderProfile.java:456)
       at androidx.camera.camera2.internal.-$$Lambda$E2rRrx9ASsJbpKoXo9ov4Zv64wI.get(-.java)
       at androidx.camera.camera2.internal.SupportedSurfaceCombination.getRecordSize(SupportedSurfaceCombination.java:1213)
       at androidx.camera.camera2.internal.SupportedSurfaceCombination.generateSurfaceSizeDefinition(SupportedSurfaceCombination.java:1168)
       at androidx.camera.camera2.internal.SupportedSurfaceCombination.<init>(SupportedSurfaceCombination.java:120)
       at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.init(Camera2DeviceSurfaceManager.java:94)
       at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:82)
       at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:65)
       at androidx.camera.camera2.Camera2Config.lambda$defaultConfig$0(Camera2Config.java:52)
       at androidx.camera.camera2.-$$Lambda$Camera2Config$kPfcZYYQs2fXKvw1cjC5GhRy6hM.newInstance(-.java)
       at androidx.camera.core.CameraX.lambda$initAndRetryRecursively$9(CameraX.java:578)
       at androidx.camera.core.CameraX.lambda$initAndRetryRecursively$9$CameraX(CameraX.java)
       at androidx.camera.core.-$$Lambda$CameraX$u-Xx2b6YXY5GXNXRh-mDiDnHdpQ.run(-.java:10)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)
```

teddy boy

unread,
Mar 2, 2021, 4:30:06 AM3/2/21
to Android CameraX Discussion Group, Android CameraX Discussion Group
Capture.PNG

Android CameraX Discussion Group

unread,
Mar 2, 2021, 5:03:57 AM3/2/21
to Android CameraX Discussion Group, teddy...@gmail.com, Android CameraX Discussion Group
Thanks Teddy. I've added your information in https://issuetracker.google.com/181599852. You can follow up the latest update from engineering team in this page.

Peter Varga

unread,
Mar 2, 2021, 7:42:32 AM3/2/21
to Android CameraX Discussion Group, Android CameraX Discussion Group, teddy...@gmail.com
Hi, 

here is the log with stack trace:
I/CameraManagerGlobal: Camera 21 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 23 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 3 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client com.samsung.android.smartface API Level 2
I/CameraManagerGlobal: Camera 4 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/CameraManagerGlobal: Camera 40 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 50 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 52 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 80 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
    Camera 91 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client android.system API Level 2
E/MediaProfiles: The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
    The given camcorder profile camera 4 quality 1 is not found
W/CameraX: Retry init. Start time 152689353 current time 152689366

    java.lang.RuntimeException: Error retrieving camcorder profile params
        at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
        at android.media.CamcorderProfile.get(CamcorderProfile.java:456)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.lambda$E2rRrx9ASsJbpKoXo9ov4Zv64wI(Unknown Source:0)
        at androidx.camera.camera2.internal.-$$Lambda$Camera2DeviceSurfaceManager$E2rRrx9ASsJbpKoXo9ov4Zv64wI.get(Unknown Source:0)

        at androidx.camera.camera2.internal.SupportedSurfaceCombination.getRecordSize(SupportedSurfaceCombination.java:1213)
        at androidx.camera.camera2.internal.SupportedSurfaceCombination.generateSurfaceSizeDefinition(SupportedSurfaceCombination.java:1168)
        at androidx.camera.camera2.internal.SupportedSurfaceCombination.<init>(SupportedSurfaceCombination.java:120)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.init(Camera2DeviceSurfaceManager.java:94)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:82)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:65)
        at androidx.camera.camera2.Camera2Config.lambda$defaultConfig$0(Camera2Config.java:52)
        at androidx.camera.camera2.-$$Lambda$Camera2Config$kPfcZYYQs2fXKvw1cjC5GhRy6hM.newInstance(Unknown Source:0)
        at androidx.camera.core.CameraX.lambda$initAndRetryRecursively$9$CameraX(CameraX.java:578)
        at androidx.camera.core.-$$Lambda$CameraX$u-Xx2b6YXY5GXNXRh-mDiDnHdpQ.run(Unknown Source:10)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

then the same because camera retries couple of times, 
then at the end:

 Caused by: java.lang.RuntimeException: Error retrieving camcorder profile params
        at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
        at android.media.CamcorderProfile.get(CamcorderProfile.java:456)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.lambda$E2rRrx9ASsJbpKoXo9ov4Zv64wI(Unknown Source:0)
        at androidx.camera.camera2.internal.-$$Lambda$Camera2DeviceSurfaceManager$E2rRrx9ASsJbpKoXo9ov4Zv64wI.get(Unknown Source:0)

        at androidx.camera.camera2.internal.SupportedSurfaceCombination.getRecordSize(SupportedSurfaceCombination.java:1213)
        at androidx.camera.camera2.internal.SupportedSurfaceCombination.generateSurfaceSizeDefinition(SupportedSurfaceCombination.java:1168)
        at androidx.camera.camera2.internal.SupportedSurfaceCombination.<init>(SupportedSurfaceCombination.java:120)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.init(Camera2DeviceSurfaceManager.java:94)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:82)
        at androidx.camera.camera2.internal.Camera2DeviceSurfaceManager.<init>(Camera2DeviceSurfaceManager.java:65)
        at androidx.camera.camera2.Camera2Config.lambda$defaultConfig$0(Camera2Config.java:52)
        at androidx.camera.camera2.-$$Lambda$Camera2Config$kPfcZYYQs2fXKvw1cjC5GhRy6hM.newInstance(Unknown Source:0)
        at androidx.camera.core.CameraX.lambda$initAndRetryRecursively$9$CameraX(CameraX.java:578)
        at androidx.camera.core.-$$Lambda$CameraX$u-Xx2b6YXY5GXNXRh-mDiDnHdpQ.run(Unknown Source:10) 

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 


The code where I get this error is:

cameraController = new LifecycleCameraController(context);
Futures.addCallback(cameraController.getInitializationFuture(), new FutureCallback<Void>() {

@Override
public void onSuccess(@Nullable Void result) {
Log.d(TAG, "createCameraController SUCCESS");
onCameraInited.accept(easyCamera);

}

@Override
public void onFailure(Throwable t) {
onFailure.accept(new EasyCameraException("Exception while creating CameraController", t));
}

}, CameraXExecutors.mainThreadExecutor());
There is nothing before this, I mean no camera related code. 
Setting the parameters, the use cases, lifecycle binding and everything else are AFTER this code so it does not matter what configuration I plan to use. (Otherwise, YES, I use the video, but I think it has nothing to do with this error. Creating the CameraController is the first step using the camera.)

The exact same code works perfectly with rc02.
The phone is a Samsung Note 10 plus, Android 11.

My gradle files looks like:
def camerax_version = '1.0.0-rc03'
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-extensions:1.0.0-alpha22"
implementation 'androidx.camera:camera-view:1.0.0-alpha22'

Cheers,
Peter

Charcoal Chen

unread,
Mar 3, 2021, 4:29:48 AM3/3/21
to Android CameraX Discussion Group, varga.pet...@gmail.com, Android CameraX Discussion Group, teddy...@gmail.com

Hi Varga,

Thanks for providing the information. It should be the issue that 1.1.0-alpha02 was unexpectedly loaded. I found an approach to force use a specific version of library to workaround the problem. Before the issue is fixed, could you have a try to modify the gradle settings for camera-core, camera-camera2 and camera-lifecycle as the following to see whether the issue still happens? Thanks.

// CameraX core library
def camerax_version = '1.0.0-rc03'
implementation("androidx.camera:camera-core") {
    version {
        strictly "$camerax_version"
    }
    because "Force use 1.0.0-rc03"
}

// CameraX Camera2 extensions
implementation("androidx.camera:camera-camera2") {
    version {
        strictly "$camerax_version"
    }
    because "Force use 1.0.0-rc03"
}

// CameraX Lifecycle library
implementation("androidx.camera:camera-lifecycle") {
    version {
        strictly "$camerax_version"
    }
    because "Force use 1.0.0-rc03"
}

Peter Varga

unread,
Mar 3, 2021, 7:07:49 AM3/3/21
to Charcoal Chen, Android CameraX Discussion Group, teddy...@gmail.com
Hi,

this way it works well!

Thanks for the advice,
Peter

Reply all
Reply to author
Forward
0 new messages