【发布时间】:2021-09-17 22:07:50
【问题描述】:
我正在尝试将我的应用配置为显示测试广告,但是当我在 android 模拟器中运行该应用时,它崩溃并出现此错误:
/Users/me/.pub-cache/hosted/pub.dartlang.org/google_mobile_ads-0.13.2/lib/src/ad_containers.dart:454:9: Error: A value of type 'Type' can't be assigned to a variable of type 'DiagnosticsNode'.
- 'Type' is from 'dart:core'.
- 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('../../../flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
ErrorSummary,
^
FAILURE: Build failed with an exception.
* Where:
Script '/Volumes/macex/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Volumes/macex/flutter/bin/flutter'' 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 56s
我正在使用:
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2.3 20D91 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!
谢谢!
【问题讨论】:
-
从错误日志中我的理解是,>
A value of type 'Type' can't be assigned to a variable of type > 'DiagnosticsNode'在代码的某处出现了类型转换问题。它期望DiagnosticsNode类型的值,但提供Type类型。
标签: android flutter googlemobileads