firebase - 如何修复flutter项目中的gradle错误

标签 firebase gradle build android-gradle-plugin gradle-plugin

我在运行 flutter 项目时遇到这个 gradle 错误:

我正在使用来自 github 的代码来实现 flutter pdf View ,并为此使用 firebase。

Launching lib\main.dart on AOSP on IA Emulator in debug mode...
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/lib/src/path_provider_windows_real.dart:126:25: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'.
          knownFolderID.addressOf, KF_FLAG_DEFAULT, NULL, pathPtrPtr);

                        ^^^^^^^^^

      ^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Error: Struct 'Utf16' is empty. Empty structs are undefined behavior.

class Utf16 extends Struct {
      ^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Error: Expected type 'T' to be a valid and instantiated subtype of 'NativeType'.
  final int totalSize = count * sizeOf<T>();
                                ^

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 28s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

请帮助我,我多次遇到这些 gradle 错误。 谢谢

最佳答案

删除.idea文件夹、build文件夹和pubspec.lock文件,就可以正常工作了。

关于firebase - 如何修复flutter项目中的gradle错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69324448/

相关文章:

ios - 点了一下firebase动态链接就记住了,怎么删除呢?

react-native - 引入闪屏后无法同步gradle,为什么?

groovy - 在build.gradle中为CLI命令编写常规代码

c++ - eclipse CDT :copying library paths from debug to release mode

javascript - 为什么 firebase 集合似乎以空行开头?

ios - 在 iOS 上选择退出 Firebase 崩溃报告

android - 在 Android 中使用 Firebase 在 RecyclerView 上获取 onClickListener

groovy - Gradle如何设置输出根路径

azure - 通过 Azure android 签名构建管道对其进行签名后,.apk 文件输出在哪里?

java - outOfMemoryError while gradle build