Issue
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.
Solution
If you faced those errors just do the following steps:
- open Android project in Android Studio (u can open a File or Class in android path then select
Open for Editing interface Android Studio
like next image)
- In
Build
window select error line then in right side selectAffected Modules
:
For each modules in opened files (
build.gradle
) addlifecycle-common-java8
api insidedependencies{}
section and then Build project:dependencies { ... api "androidx.lifecycle:lifecycle-common-java8:2.2.0" }
- Finally close Android project and run Flutter project.
Answered By - Saeid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.