close

[Solved] Gradle failure may have been because of AndroidX incompatibilities in this Flutter app

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Gradle failure may have been because of AndroidX incompatibilities in this Flutter app in a flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How Gradle failure may have been because of AndroidX incompatibilities in this Flutter app Error Occurs ?

When I import webview_flutter package in my app. I got AndroidX incompatibilities ereor. How to solve this error ?

BUILD FAILED in 4m 32s ******************************************************************************************* The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.

How to Solve Gradle failure may have been because of AndroidX incompatibilities in this Flutter app Error?

  1. How to Solve Gradle failure may have been because of AndroidX incompatibilities in this Flutter app Error?

    To Solve Gradle failure may have been because of AndroidX incompatibilities in this Flutter app You have to Migrate your app to Android X. Just follow below all steps to migrate to AndroidX. Open Android Studio. Select Open an existing Android Studio Project. Open the android directory within your app. Wait until the project has been synced successfully. (This happens automatically once you open the project, but if it doesn’t, select Sync Project with Gradle Files from the File menu). Select Migrate to AndroidX from the Refactor menu. If you are asked to back up the project before proceeding, check the Backup project as a Zip file, then click Migrate. Lastly, save the zip file in your location of preference. The refactoring preview shows the list of changes. Finally, click Do Refactor. And also add this line In your Project folder > android > app > build.gradle, add the following line in.

  2. Gradle failure may have been because of AndroidX incompatibilities in this Flutter app

    To Solve Gradle failure may have been because of AndroidX incompatibilities in this Flutter app You have to Migrate your app to Android X. Just follow below all steps to migrate to AndroidX. Open Android Studio. Select Open an existing Android Studio Project. Open the android directory within your app. Wait until the project has been synced successfully. (This happens automatically once you open the project, but if it doesn’t, select Sync Project with Gradle Files from the File menu). Select Migrate to AndroidX from the Refactor menu. If you are asked to back up the project before proceeding, check the Backup project as a Zip file, then click Migrate. Lastly, save the zip file in your location of preference. The refactoring preview shows the list of changes. Finally, click Do Refactor. And also add this line In your Project folder > android > app > build.gradle, add the following line in.

Solution 1 : Migrate to AndroidX

You have to Migrate your app to Android X. Just follow below all step to migrate to AndroidX.

  1. Open Android Studio.
  2. Select Open an existing Android Studio Project.
  3. Open the android directory within your app.
  4. Wait until the project has been synced successfully. (This happens automatically once you open the project, but if it doesn’t, select Sync Project with Gradle Files from the File menu).
  5. Select Migrate to AndroidX from the Refactor menu.
  6. If you are asked to backup the project before proceeding, check Backup project as Zip file, then click Migrate. Lastly, save the zip file in your location of preference.
  7. The refactoring preview shows the list of changes. Finally, click Do Refactor.
  8. And also add this line In your Project folder > android > app > build.gradle, add the following Line in.
multiDexEnabled true

Then after Run flutter clean and rebuild your project.

Solution 2 : Enable multidex

Just Enable multidex.

Go to [project_folder]/app/build.gradle and add following lines.

defaultConfig {
    ...
    multiDexEnabled true
}

Enable Jetifier.

And Then Go to [project_folder]/android/app/gradle.properties and add following lines.

android.useAndroidX=true
android.enableJetifier=true

Solution 3 : Add dependencies


Just Enable multidex and add dependencies in app/build.gradle file.

defaultConfig {   
     ....
     multiDexEnabled true             
 }
dependencies {
    .....
    implementation 'com.android.support:multidex:2.0.1'
}

Summery

So, It’s All About this error. I hope this tutorial helps you to Solve your error. Please Comment Below if You stucks anywhere with my code. And please comment below on which solution worked for you. Thank You.

Also Check Out Below Tutorials

Leave a Comment

%d bloggers like this: