Recently I opened my old project and there is a warning right now that nothing like this was happening before
Warning looks like
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project.
flutter doctor -v summary
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.3 19D76, locale en-GB)
• Flutter version 1.22.2 at /Users/pkimac/Development/flutter
• Framework revision 84f3d28555 (6 weeks ago), 2020-10-15 16:26:19 -0700
• Engine revision b8752bbfff
• Dart version 2.10.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/pkimac/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.10.0.rc.1
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • 7A52F1D0-79F7-471C-AA62-3C106114A1A9 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
! Error: Paresh’s iPhone has recently restarted. Xcode will continue when Paresh’s iPhone is unlocked. (code -14)
! Doctor found issues in 1 category.
What does this mean and how can I solve this warning?
I got the same error in one of my old projects and this worked for me:
/path to your project/android/app/src/main/AndroidManifest.xml
Change your android app naming from:
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Your App Name"
android:icon="@mipmap/ic_launcher">
To
<application
android:name="${applicationName}"
android:label="Your App Name"
android:icon="@mipmap/ic_launcher">
build.gradle
file.
check the path: /path to your project/android/app/build.gradle
Upgraded mine to:
android {
compileSdkVersion 31
.....
}
Next in your andriod/build.gradle
upgrade Kotlin version ext.kotlin_version
to:
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
This will now solve the error. Also after making the changes run flutter clean
command and do a fresh build of the project.
For more info, checkout this article https://flutter.dev/go/android-project-migration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With