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
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
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
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:
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: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects
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…
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.
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.