英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论