When I run the command
flutter pub run build_runner build
I get the response:
Your Flutter application is created using an older version
of the Android embedding. It is being deprecated in favor of Android embedding v2. Follow the steps at
https://flutter.dev/go/android-project-migration
to migrate your project. You may also pass the
--ignore-deprecation flag to ignore this check and continue with the deprecated v1 embedding. However, the v1 Android embedding will be removed in future versions of Flutter.
The trick is, I canβt seem to use --ignore-deprecation flag Could not find an option named βignore-deprecationβ.
Can someone help me out? Iβd prefer not to go through the migration steps indicated for a project from a bookβ¦
Iβm now getting this on starter projects I open from the book. It seems like something has changed with the latest updates to Android Studio and Flutter.
For example, 07-routes-and-navigation/projects/starter
Open in Android Studio, Flutter > Pub Get
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Warning
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at
to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The detected reason was:
/Users/geoff/AndroidStudioProjects/flutter/07-routes-and-navigation/android/app/src/main/AndroidManifest.xml uses android:name="io.flutter.app.FutterApplication"
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Running βflutter pub getβ in 07-routes-and-navigationβ¦ 2,466ms
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.
Take a look at the docs for migrating an app: Upgrading pre 1.12 Android projects Β· flutter/flutter Wiki Β· GitHub
Tried Flutter > Clean. Tried following the instructions for V2 migration. Tried Restart / Invalid Cache in Android Studio. Coming up empty handed.
Looks like Iβm stuck for now. None of the book projects will build anymore.
Creating a new project using Android Studio New Flutter Project wizard does work (albeit with some warning about remapping name spaces from 02 to 01; not terribly reassuring).
A New flutter project I created just that way a few weeks ago, similarly gives the warning now.
Perhaps I need to try starting a new project, and then adding in the code files from the book starter projects.
Starting to doubt my sanityβ¦
Updatedβ¦
So, I completely uninstalled Android Studio and Flutter. Then re-installed. Still no dice. I can build a new Flutter project just fine. Trying to open one of the Flutter Apprentice starter projects results in the same warning, which then stops the build.
Looks like Iβm going to have to import each chapterβs starter code into a newly created Flutter app if I want to continue with the book examples.
Thanks for reporting this.
Weβll fix it in a future update to the book.
In the meantime this should be the minimal set of changes needed to build the app for Android.
https://github.com/raywenderlich/flta-materials/compare/quick-update
I did it only for chapter 7 but very similar updates should work also on other chapters.
Thanks for the response. I will give the changes a try. Hope the repository source can be updated soon! Itβs a great book, and Iβve been learning quite a bit from it compared to my previous run-through with the standard Flutter tutorials.