Wisnu Wijokangko
Wisnu Wijokangko

Reputation: 2278

Flutter Gradle failure cause by AndroidX incompatibilities

I just add firebase_messaging to pubspec.yaml and run the app. After that, I got error that describe it might be some issue with the gradle because of AndroidX incompatibilities. What seems to be the issue here, is it the AndroidX or the dependencies? Thank you

debug console

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

Upvotes: 2

Views: 4890

Answers (1)

SilenceCodder
SilenceCodder

Reputation: 3174

Goto C:\Users\Pcname\projectname\android Open gradle.properties And add this

android.useAndroidX=true
android.enableJetifier=true

Upvotes: 4

Related Questions