Can't import androidx.work.WorkManager. Working with Studio 3.4
How do I import androidx.work.WorkManager?
Asked Answered
have u added in your dependencies –
Fulbert
What dependencies do I have to add? Already done this(gradle.properties): android.useAndroidX=true android.enableJetifier=true –
Moo
Just add this and it should work. in your dependencies block in build.gradle at app level.
dependencies {
//other dependencies
//......
implementation "androidx.work:work-runtime:2.3.1"
}
You first need to add the work manager dependency in your app's build.gradle file within the dependencies block like this:
dependencies {
def work_version = "2.3.1"
// (Java only)
implementation "androidx.work:work-runtime:$work_version"
// Kotlin + coroutines
implementation "androidx.work:work-runtime-ktx:$work_version"
// optional - RxJava2 support
implementation "androidx.work:work-rxjava2:$work_version"
// optional - GCMNetworkManager support
implementation "androidx.work:work-gcm:$work_version"
// optional - Test helpers
androidTestImplementation "androidx.work:work-testing:$work_version"
}
(source)
Just use the one you need and feel free to omit the optionals. Then you would be able to import it in your classes/activities. If not Clear your caches and sync your project with the gradle files and try again.
© 2022 - 2024 — McMap. All rights reserved.