gpt4 book ai didi

flutter - 由AndroidX不兼容引起的Flutter Gradle故障

转载 作者:行者123 更新时间:2023-12-03 03:16:54 25 4
gpt4 key购买 nike

我只是将firebase_messaging添加到pubspec.yaml并运行该应用程序。之后,由于AndroidX不兼容,我收到了错误消息,描述它可能是gradle的问题。这里似乎是问题所在,是AndroidX还是依赖项?谢谢

调试控制台

Launching lib/main.dart on LUNA V55 in debug mode...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.appcompat:appcompat' has different version for the compile (1.0.0) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution

* 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 19s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

pubspec.yaml
name: flutter_notification
description: A new Flutter project.

version: 1.0.0+1

environment:
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

cupertino_icons: ^0.1.2
firebase_messaging: ^5.0.4
http: ^0.12.0+2
shared_preferences: ^0.5.3+1
intl: ^0.15.8
image_picker: ^0.6.0+9
share: ^0.6.1+1
flutter_calendar: ^0.0.8
swipedetector: ^1.2.0
barcode_scan: ^1.0.0
carousel_pro: ^0.0.13
carousel_slider: ^1.3.0
shimmer: ^1.0.0
flutter_search_panel: ^1.0.1
percent_indicator: ^2.1.0
after_layout: ^1.0.7+1
url_launcher: ^5.0.3
table_calendar: ^1.2.2
flutter_datetime_picker: ^1.2.1
email_validator: '^1.0.0'
dio: ^2.1.7
path_provider: ^1.1.0
flutter_html: ^0.10.1+hotfix.1

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true

最佳答案

转到C:\Users\Pcname\projectname\android 打开gradle.properties
并添加这个

android.useAndroidX=true
android.enableJetifier=true

关于flutter - 由AndroidX不兼容引起的Flutter Gradle故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56764843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com