Flutter project won't run in Android Studio with AndroidX
compatibility and returns following errors in Run/Console window:
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':flutter_keyboard_visibility:javaPreCompileDebug'. Could not resolve all files for configuration ':flutter_keyboard_visibility:debugCompileClasspath'. Could not find lifecycle-common-java8.jar (androidx.lifecycle:lifecycle-common-java8:2.0.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-common-java8/2.0.0/lifecycle-common-java8-2.0.0.jar
And
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring root project 'path_provider'. SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
If you faced those errors just do the following steps:
Open for Editing interface Android Studio
like next image)Build
window select error line then in right side select Affected Modules
:For each modules in opened files (build.gradle
) add lifecycle-common-java8
api inside dependencies{}
section and then Build project:
dependencies {
...
api "androidx.lifecycle:lifecycle-common-java8:2.2.0"
}