your Application should look similar to this:
public class AppController extends Application implements CameraXConfig.Provider {
and the implemented method like this:
@NonNull
@Override
public CameraXConfig getCameraXConfig() {
return Camera2Config.defaultConfig(this);
}
works for me with the same setup you posted in the google group
ie
def camerax_version = "1.0.0-alpha07"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-view:1.0.0-alpha04"
in the Activity all I do is:
bind cameraView and bind it to the activity:
@BindView(R.id.cameraView)
CameraView cameraView;
....
if (checkCameraAndStoragePermissions()) {
initializeView();
} else {
askCameraAndStoragePermissions(new SingleObserver<Boolean>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(Boolean response) {
if (response) {
initializeView();
}
}
@Override
public void onError(Throwable e) {
}
});
}
@SuppressLint("MissingPermission")
private void initializeView() {
...
cameraView.bindToLifecycle(this);
...
}