我在Flutter更新后遇到了一个错误。来自两个库的AssetManifest已被导入。

huangapple go评论76阅读模式
英文:

I encounter an error after a flutter update. AssetManifest imported from two libraries

问题

I have an app that I created a year ago that worked great. Lately I opened my code and Flutter suggested I do an update. After the update it no longer works. the error encountered indicates that I imported AssetManifest from 'package:flutter/src/services/asset_manifest.dart' and from 'package:google_fonts/src/asset_manifest.dart'.

英文:

I have an app that I created a year ago that worked great. Lately I opened my code and Flutter suggested I do an update. After the update it no longer works. the error encountered indicates that I imported AssetManifest from 'package:flutter/src/services/asset_manifest.dart' and from 'package:google_fonts/src/asset_manifest.dart'.

> Launching lib/main.dart on AOSP on IA Emulator in debug mode...
> Running Gradle task 'assembleDebug'...
> ../../.pub-cache/hosted/pub.dev/google_fonts-3.0.1/lib/src/google_fonts_base.dart:14:1:
> Error: 'AssetManifest' is imported from both
> 'package:flutter/src/services/asset_manifest.dart' and
> 'package:google_fonts/src/asset_manifest.dart'. import
> 'asset_manifest.dart'; ^^^^^^^^^^^^^
> ../../.pub-cache/hosted/pub.dev/google_fonts-3.0.1/lib/src/google_fonts_base.dart:34:31:
> Error: 'AssetManifest' is imported from both
> 'package:flutter/src/services/asset_manifest.dart' and
> 'package:google_fonts/src/asset_manifest.dart'. AssetManifest
> assetManifest = AssetManifest();
> ^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception
>
>
> FAILURE: Build failed with an exception.
>
> * Where: Script '/Users/innot/Developer/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy'
> line: 1214
>
> * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
> > Process 'command '/Users/innot/Developer/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 7s Exception: Gradle task assembleDebug failed with
> exit code 1

答案1

得分: 1

根据这里提到的,google_fonts的版本4.0.1修复了这个问题。因此,升级至至少版本4.0.1应该能解决您的问题。

英文:

As mentioned here, version 4.0.1 of the google_fonts fixes this issue. Therefore, upgrading to at least version 4.0.1 should resolve your problem.

huangapple
  • 本文由 发表于 2023年6月25日 16:58:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76549644.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定