我在我的项目中使用flutter_local_notifications,将其添加到pubspec.yaml中,然后按pub get。
但是启动应用程序后,我遇到以下错误:
* What went wrong:
A problem occurred configuring project ':flutter_local_notifications'.
> Could not resolve all artifacts for configuration ':flutter_local_notifications:classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.jar
> Could not find builder.jar (com.android.tools.build:builder:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.3/builder-3.5.3.jar
> Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.3/crash-26.5.3.jar
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.3/lint-gradle-api-26.5.3.jar
> Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.3/gradle-api-3.5.3.jar
> Could not get unknown property 'android' for project ':flutter_local_notifications' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin flutter_local_notifications...
Running Gradle task 'assembleAarRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'flutter_local_notifications'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle.jar (com.android.tools.build:gradle:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.jar
> Could not find builder.jar (com.android.tools.build:builder:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.3/builder-3.5.3.jar
> Could not find crash.jar (com.android.tools.analytics-library:crash:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.5.3/crash-26.5.3.jar
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.5.3/lint-gradle-api-26.5.3.jar
> Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.5.3).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.5.3/gradle-api-3.5.3.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Exception: The plugin flutter_local_notifications could not be built due to the issue above.
这是 flutter 医生:
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.6)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] Connected device (1 available)
谁能帮我这个忙!
我不知道如何解决它,我也需要我的项目!
我卡在里面!
最佳答案
我最终通过将gradle升级到最新版本来修复它。
只需按照:https://gradle.org/install/中的说明进行操作,请使用Gradle Wrapper进行升级。