【问题标题】:How to fix gradle error in flutter project如何修复flutter项目中的gradle错误
【发布时间】:2021-11-18 07:04:53
【问题描述】:

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

我正在使用来自 github 的代码来获取 Flutter pdf 视图,并且还使用了 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 错误。 谢谢

【问题讨论】:

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


【解决方案1】:

删除.ida文件夹、build文件夹和pubspec.lock文件,就可以正常使用了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-11
    • 2019-11-01
    • 1970-01-01
    • 2016-02-25
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2022-06-18
    相关资源
    最近更新 更多