【发布时间】:2021-04-04 13:42:41
【问题描述】:
将 CachedNetworkImage 依赖项添加到我的 Flutter 项目并尝试使用 vscode(和 Intellij..)flutter run 后,引发了以下异常:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':path_provider'.
> Could not resolve all artifacts for configuration ':path_provider:classpath'.
> Could not find sdklib.jar (com.android.tools:sdklib:26.3.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.3.0/sdklib-26.3.0.jar
> Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.3.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.3.0/apkzlib-3.3.0.jar
> Could not find apksig.jar (com.android.tools.build:apksig:3.3.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.3.0/apksig-3.3.0.jar
> Could not get unknown property 'android' for project ':path_provider' 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 17s
Exception: Gradle task assembleDebug failed with exit code 1
我在 pubspec.yaml 文件中得到了以下依赖项:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cached_network_image: ^2.5.0
cupertino_icons: ^1.0.0
curved_navigation_bar: ^0.3.7
flutter_launcher_icons: ^0.8.1
flutter_riverpod: ^0.12.4
http: ^0.12.2
material_floating_search_bar: ^0.2.6
shimmer: ^1.1.2
我正在使用最新的 pre-nullsafety 版本,因为我还没有为 Flutter 2.0 做好准备。
我不认为被阻止的
如果您对我收到此错误的原因有任何见解,请分享您的想法,我整天都在研究它:(
【问题讨论】:
-
尝试
flutter clean然后flutter pub get最后运行项目