Flutter returns `lifecycle-common-java8.jar (androidx.lifecycle:lifecycle-common-java8:2.0.0)` 错误
Flutter returns `lifecycle-common-java8.jar (androidx.lifecycle:lifecycle-common-java8:2.0.0)` error
Flutter 项目不会 运行 在 Android Studio 中具有 AndroidX
兼容性和 returns 以下 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
和
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.
如果您遇到这些错误,请执行以下步骤:
- 在 Android Studio 中打开 Android 项目(你可以在 android 路径中打开一个文件或 Class 然后 select
Open for Editing interface Android Studio
比如下一张图片)
- 在
Build
window select错误行然后在右边select Affected Modules
:
对于打开的文件 (build.gradle
) 中的每个模块,在 dependencies{}
部分添加 lifecycle-common-java8
api,然后构建项目:
dependencies {
...
api "androidx.lifecycle:lifecycle-common-java8:2.2.0"
}
- 最后关闭Android项目和运行Flutter项目。
Flutter 项目不会 运行 在 Android Studio 中具有 AndroidX
兼容性和 returns 以下 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
和
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.
如果您遇到这些错误,请执行以下步骤:
- 在 Android Studio 中打开 Android 项目(你可以在 android 路径中打开一个文件或 Class 然后 select
Open for Editing interface Android Studio
比如下一张图片)
- 在
Build
window select错误行然后在右边selectAffected Modules
:
对于打开的文件 (
build.gradle
) 中的每个模块,在dependencies{}
部分添加lifecycle-common-java8
api,然后构建项目:dependencies { ... api "androidx.lifecycle:lifecycle-common-java8:2.2.0" }
- 最后关闭Android项目和运行Flutter项目。