我最近决定根据 pub.dev 将我的 Flutter 依赖项和 pubspec.yaml 全部升级到最新版本。
因为我主要用 iOS 进行测试,所以我才意识到我的 android 版本不再工作了。不幸的是,错误消息的直接信息很少。
Gradle sync failed: Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle8805841490318013448.bin offset 286370 exists? true
Consult IDE log for more details (Help | Show Log) (25 s 303 ms)
然而,我决定也为我的 android studio 提供 4.1 的更新,并升级了 gradle 依赖项。
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2' // 3.5.1
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4' // 4.3.3
}
android studio 中的新尝试提供了一个与 Firebase 相关的更相关的错误
Gradle sync failed: Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle1329056569736096566.bin offset 296201 exists? true
Corrupt serialized resolution result. Cannot find selected module (224) for constraint platform-runtime -> com.google.firebase:firebase-iid:21.0.1
Consult IDE log for more details (Help | Show Log) (10 m 18 s 294 ms)
我的 Flutter Doctor -v 让我相信一切都很好。 (插件错误是 Flutter 团队现有的已知问题,与 Android Studio 4.1 无关)
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.1 20C69 darwin-x64, locale de-DE)
• Flutter version 1.22.6 at /Users/kaibaier/development/flutter
• Framework revision 9b2d32b605 (5 days ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/kaibaier/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/kaibaier/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.9.3
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.18.1
[✓] Connected device (1 available)
• Redmi Note 8 (mobile) • 18d3ce30 • android-arm64 • Android 10 (API 29)
为了完成,我还添加了 pubspec.yaml 依赖项和以前使用的版本。您会注意到 Firebase 和 Google 地图中的版本大幅跃升
dependencies:
flutter:
sdk: flutter
permission_handler: ^5.0.1+1
cupertino_icons: ^1.0.0 #^0.1.3
firebase_core: ^0.7.0 # ^0.5.0
firebase_auth: ^0.20.0+1 # ^0.18.0+1
firebase_storage: ^7.0.0 # ^4.0.0
cloud_firestore: ^0.16.0 #^0.14.0+2
provider: ^4.3.3 #^4.3.2
flutter_spinkit: ^4.1.2+1
flutter_vector_icons: ^0.2.1
intl: ^0.16.1
image_cropper: ^1.3.1
image_picker: ^0.6.7+21 #^0.6.7+11
searchable_dropdown: ^1.1.3
flutter_colorpicker: ^0.3.5 #^0.3.4
flutter_masked_text: ^0.8.0
shared_preferences: ^0.5.12+4 #^0.5.8
path_provider: ^1.6.27 #^1.6.11
location: ^3.2.4 #^3.0.2
table_calendar: ^2.3.3 #^2.2.3
url_launcher: ^5.7.10 #^5.6.0
google_maps_flutter: ^1.1.1 #^0.5.32
flutter_google_places: ^0.2.6
http: ^0.12.2 #^0.12.1
uuid: ^2.2.2 #^2.0.4
flutter_appcenter_bundle: ^3.2.0+2
preload_page_view: ^0.1.4
device_preview: ^0.5.5 #^0.4.8
wakelock: ^0.2.1+1 #^0.1.4+2
非常欢迎任何帮助/想法或想法:)
更新: 尝试在我的 Android 手机上再次运行测试后,我遇到了另一个相关错误。
Note: /Users/kaibaier/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/android/src/main/java/io/flutter/plugins/firebase/core/FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Problems reading data from Binary store in /private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle3299415366350440389.bin offset 0 exists? true
* 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.
更新#2: 我也在 GitHub 上发布了这个问题 https://github.com/FirebaseExtended/flutterfire/issues/4848
更新 #3: 好的,我能够弄清楚这个文件:/private/var/folders/mw/s9362rr10qv43x_yh6qgm17w0000gn/T/gradle3299415366350440389.bin 只存在于构建阶段。抛出错误后,直接又没了。
更新#4: 我现在回滚到旧的 firebase 依赖项。刚刚升级了firebase存储。在一些 pod 和 Grasflecks 清洁后,一切运行顺利。 我的问题仍然存在,因为我希望回到新版本的 firebase dependencies 。但现在我可以重新构建。
答案 0 :(得分:0)
我在 Firebase 升级后遇到了完全相同的问题。与 pubspec.yaml 一起,您需要在 app/build.gradle 中升级另一个(有些隐藏的)依赖项。我把我的从 17.x 改成了这个,所有的构建和运行。
实现'com.google.firebase:firebase-analytics:18.0.2'