我只是将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)
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
答案 0 :(得分:0)
转到C:\Users\Pcname\projectname\android
打开 gradle.properties
并添加这个
android.useAndroidX=true
android.enableJetifier=true