简体   繁体   中英

How can I solve the version of the Android embedding?

I have this problem. Plz let me know how to solve this problem.. I got this git code from a lesson made about 2years ago. Also different errors showed up when I made a flutter project using git code.

-> This is the problem This app is using a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.

If the application is very old, you should consult the migration guide that the documentation or fial offers you, just like the other answers recommend.

https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

but if you still have the deprecated application warnning try the following

  • step one: delete the cache. flutter clean
  • step two: remove the pubspec.lock file from the root of the project. rm pubspec.lock
  • step three: update the libraries if you have any very outdated, you can do it manually or through the command. flutter pub upgrade --major-versions (this command will update all the libraries you have, be careful, before evaluating if such an update is necessary in your project).

then you must make some changes at the android folder level

  • change the gradle.zip in android/gradle/wrapper/gradle-wrapper.properties to a newer version like:

     distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
  • and in android/build.gradle update the version to

    classpath 'com.android.tools.build.gradle:7.1.2'
  • the kotlin version in: ext.kotlin_version = '1.6.10'

and if you were using code obfuscation with proguard-rules.pro remove any added configurations that reference that file in android/app/build.gradle and you should be left with just this

    buildTypes {
    release {
       
        signingConfig signingConfigs.release

     }
   }

finally close the code editor or the IDE you use and in console run flutter pub get and run your project flutter run

Last but not least, do not forget to update the build version of your application to API 33 or higher and have your android studio updated (VERY IMPORTANT FOR UPDATE, ) android-studio

If you are here because of the flutter 2.10, do this:

Change this:

<application
    android:icon="@mipmap/ic_launcher"
    android:name="io.flutter.app.FlutterApplication"
    android:label="PassesBox"
    ...

To this:

<application
    android:icon="@mipmap/ic_launcher"
    android:name="${applicationName}"
    android:label="PassesBox"
    ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM