Flutter Projects & Android X Migration Issues

后端 未结 9 1171
粉色の甜心
粉色の甜心 2020-11-27 14:51

I just created a new flutter project, added a few plugins and I\'m getting the plugin switched to android x therefore i need to switch to android x. I\'ve tried all the diff

相关标签:
9条回答
  • 2020-11-27 15:29

    it was still not working after I migrated to androidx

    I simply install google play service on my sdk and it worked

    0 讨论(0)
  • 2020-11-27 15:32

    After a lot of tries, I've just created a new Flutter project and just copy past the pubspec.yaml, lib and assets folder from the old project to the new one, and the problem solved

    0 讨论(0)
  • 2020-11-27 15:33

    When you update your Android Studio version from 3.2 to 3.3. Android Studio version 3.3 onwards you can either use either android libraries or androidx libraries but

    In flutter platform, flutter will always take the newest configuration of android studio.

    This is the main reason why users get an error to use dependency according to androidx.

    To migrate the flutter project to AndroidX, check this link: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

    0 讨论(0)
  • 2020-11-27 15:40

    I Faced this problem recently. After looking for many hours I came across this medium page https://medium.com/@swhussain110/how-to-migrate-your-flutter-app-to-androidx-9a78eaaa924b

    Follow these steps

    1. In project level build.gradle change classpath to com.android.tools.build:gradle:3.3.1.
    2. In app level build.gradle change your compileSdkVersion and targetSdkVersion to 28.
    3. Now right click on android directory in your flutter project go to Flutter and click on Open Android module in Android Studio. Open project in a new window.
    4. Now go to Refactor in the toolbar and click Migrate to AndroidX.
    5. Then click Do Refactor and wait for gradle to build.
    0 讨论(0)
  • 2020-11-27 15:41

    I've made the migration successfully by using Sam's answer!

    1. Open the Flutter project into Android Studio
    2. Right click on the android directory and Flutter -> Open Android module in Android Studio. It asked me to upgrade my gradle plugin.
    3. Then I installed Google Play Services. Tools -> SDK Manager -> SDK Tools and chek the Goolge Play Services.
    
    0 讨论(0)
  • 2020-11-27 15:41

    Add this to the end of your pubspec.yaml file, without any parent:

    module:
      androidX: true
    

    Then, at android/graddle.properties add:

    android.useAndroidX=true
    android.enableJetifier=true
    

    Run at your CLI:

    flutter clean
    

    and rerun your code

    flutter run
    

    This may adjust your problem with AndroidX.

    For your SDK, i think you may change inside android/app/build.gradle

    minSdkVersion 21
    targetSdkVersion 28
    multiDexEnabled true
    

    the multiDexEnabled is optional (in case of some error related to it).

    I think this may solve your problem, please give me a feedback about it.

    0 讨论(0)
提交回复
热议问题