Black image

41 views
Skip to first unread message

an honest observer

unread,
Mar 29, 2021, 12:55:05 AM3/29/21
to Android CameraX Discussion Group
Hello. I'm following this tutorial https://codelabs.developers.google.com/codelabs/camerax-getting-started#4. When I take a picture, it results in a black image. My emulator is 10.1  WXGA (Tablet) API 25.  When I use API 30, it works. What can I do to make it work in lower API levels? Thank you.

Some of my configurations:
ext.kotlin_version = "1.3.72"
classpath 'com.android.tools.build:gradle:4.1.3'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.example.cameraxapp"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}

dependencies {
def camerax_version = "1.0.0-beta07"
// CameraX core library using camera2 implementation
implementation "androidx.camera:camera-camera2:$camerax_version"
// CameraX Lifecycle Library
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha14"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

Scott Nien

unread,
Mar 29, 2021, 2:29:28 AM3/29/21
to an honest observer, Android CameraX Discussion Group
Hi 
Can you test on a physical device ?   

As it said in the first page of the code lab:   We recommend using an AVD that is based on Android 11 or higher,  or physical android devices. 
It is because for emulators of lower API level, the camera functionality may not be supported well. 


Scott


--
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/6c68defc-c1dd-4426-bb4f-30e150d73820n%40android.com.

an honest observer

unread,
Mar 29, 2021, 4:24:18 AM3/29/21
to Android CameraX Discussion Group, Scott Nien, Android CameraX Discussion Group, an honest observer
Okay I've tested on a physical device which is Android 8 and it works. Thank you for the input.

Scott Nien

unread,
Mar 29, 2021, 5:07:20 AM3/29/21
to an honest observer, Android CameraX Discussion Group
That's great!  Any feedback is welcome here.  
Reply all
Reply to author
Forward
0 new messages