title: How to fix AndroidX compatibility for Flutter in Android Studio?
body: <p>I'm getting this error when trying <code>flutter build apk</code> :</p>
  
  <pre><code>*******************************************************************************************
  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.
  *******************************************************************************************
  Gradle task assembleRelease failed with exit code 1
  </code></pre>
  
  <p>But I can make my code run directly on a phone or an emulator...
  I already created APK files with that project (and sent it to the stores). The last APK was created on 2019/07/17. Since then, I only added some data in lists.</p>
  
  <p>I already tried to compile in the same conditions than the last time then :</p>
  
  <ul>
  <li><code>flutter clean</code>, etc.;</li>
  <li>Invalidating caches;</li>
  <li>Downgrade Flutter version;</li>
  <li>Downgrade Kotlin version;</li>
  <li>Downgrade Gradle version;</li>
  <li>Downgrade Gradle-wrapper's distribution URL.</li>
  </ul>
  
  <p>Here are my dependencies :</p>
  
  <pre class="lang-dart prettyprint-override"><code>dependencies:
    flutter:
      sdk: flutter
    cloud_firestore: any
    firebase_auth: any
    google_sign_in: ^3.2.4
    flutter_datetime_picker: 1.0.7
    numberpicker: any
    flutter_svg: any
    dio: any
    path_provider: any
    firebase_messaging: any
    charts_flutter: any
    barcode_scan: 1.0.0
    unity_ads_flutter: any
    progress_indicators:
  </code></pre>
  
  <p>Gradle files :</p>
  
  <pre><code>buildscript {
      ext.kotlin_version = '1.3.31'
      repositories {
          google()
          jcenter()
      }
  
      dependencies {
          classpath 'com.android.tools.build:gradle:3.4.2'
          classpath 'com.google.gms:google-services:4.3.0'
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
      }
  }
  </code></pre>
  
  <pre><code>dependencies {
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.2.0'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation 'com.google.firebase:firebase-core:17.0.1'
      implementation 'com.google.firebase:firebase-auth:18.1.0'
      implementation 'com.google.firebase:firebase-messaging:19.0.1'
      implementation 'com.google.android.gms:play-services-auth:17.0.0'
      implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  }
  </code></pre>
  
  <p><strong>[EDIT] I changed my computer. Might it be the issue reason ?</strong></p>
  
  <p><strong>[EDIT 2] SOLVED</strong></p>
  
  <p>Steps:</p>
  
  <ul>
  <li>Upgrade packages</li>
  </ul>
  
  <pre class="lang-dart prettyprint-override"><code>dependencies:
    flutter:
      sdk: flutter
    cloud_firestore: any
    firebase_auth: any
    google_sign_in: any
    flutter_datetime_picker: 1.0.7
    numberpicker: any
    flutter_svg: any
    dio: any
    path_provider: any
    firebase_messaging: any
    charts_flutter: any
    barcode_scan: 1.0.0
    unity_ads_flutter: any
    progress_indicators:
  </code></pre>
  
  <ul>
  <li>Copy all files in new project</li>
  </ul>
  
  <p>It looks like some files were corrupted or lost during transfers to my new computer</p>