You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generated Flutter Module Files Do Not Use AndroidX #28805
Flutter generated files still target SDK 27 and use the non AndroidX version of libraries which conflicts with projects that target SDK 28 and use AndroidX.
I've previously opened an issue about this at Add Flutter to Existing App Fails, Flutter Tools Generates Incorrect Files#22090
It's been 5 months and 2 major version releases later so I would like to ask about plans to update the generated files. The problem is that the generated files overwrite my fixes which means I have to make the same fixes EVERY TIME just to build my project.
Are there plans to update Flutter to target SDK 28 and use AndroidX?
@jonahwilliams@gspencergoog@dnfield@jason-simmons Do any of you know the right group of people to assemble to make a decision about SDK versions and included libs like AndroidX? This question applies both to a Flutter project, as well as the Android embedding, itself.
@searchy2 @jiechic what is the output of flutter-doctor please? I just did file-new-project in intellij with Flutter (Channel stable, v1.2.1) and I get CompiledSDK 28 target SDK 28
I also get the same desired/good behaviour (target 28) with add2app .android directories recently created wit flutter 1.2.1
although i would agree communication about it is very important please, e.g. https://github.com/flutter/flutter/wiki/Changelog and an entry on flutter.dev FAQ for Android developers or even more since the play store requirement is so urgent (august timeline) every year - so charting this item very carefully would be greatly appreciated.
"the other guys" have done poorly in this area so it would be great if flutter would do excellent in this area
I'll create a new project from scratch and give it a try. Flutter has been giving me a lot of problems lately with Git and not committing the right files in .gitignore. Fingers crossed starting a new project will generate the correct file sdk targets.
Android X is a bit thorny right now partly because of plugins. In the ecosystem, some plugins are migrated to Android X, others are not. Processes that we'd hope would assist with migrating automatically projects aren't quite working here. We're investigating this to try to figure out how to make the migration as painless as possible - but it's not quite there yet.
If you need this today, you'd have to migrate the template yourself, and then it's possible that you will have trouble using some plugins that have not yet migrated to Android X. The dependency interactions get kind of messy and TBH I'm not 100% clear on which configurations do and don't work at this point.
This is definitely on our radar, but I don't have a good notion right now for when we'll have it resolved.
I think the issue there is that there are still quite a few plugins that haven't updated to AndroidX yet.
Switching to AndroidX in the template would break compatibility.
Google build Jetifier for this exact reason - to rewrite the class files of dependencies to use AndroidX. The best fix here would be to get Jetifier working with the Flutter module.
Understood. So why not prepare a separate branch to be compatible with the upcoming AndroidX? That should be an easy task. Hell, I would submit a PR if the Flutter team would accept that as a viable route.
I've created a PR (above) that adds support for AndroidX. It adds a new flag to the module section of a pubspec.yaml file which controls whether the generated files use AndroidX.
A) ran flutter create --androidx -t module my_flutter <-- added the --androidx flag.
This generates the flutter module and all other files within the project.
B) Updated my settings.gradle
C) Added the flutter module as an implementation dependency to my gradle
However, the pubspec.yaml file does not have this flag added: androidX: true. The generated java Flutter classes still use the old android support libraries.
@omid-io I've just created a small PR to fix that, but you can add the androidX flag manually and run flutter packages get and the generated files will be updated to androidX.
Keeping this issue open because there's still issues with converting an existing project to AndroidX.
AndroidX compatibility is still not enabled by default which means that new projects that are created needs to be converted to AndroidX. Unfortunately, the conversion process doesn't always work. When can AndroidX be enabled by default?
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
jonahwilliams commentedon Mar 3, 2019
cc @matthew-carroll
matthew-carroll commentedon Mar 3, 2019
@jonahwilliams @gspencergoog @dnfield @jason-simmons Do any of you know the right group of people to assemble to make a decision about SDK versions and included libs like AndroidX? This question applies both to a Flutter project, as well as the Android embedding, itself.
jiechic commentedon Mar 4, 2019
the same problem on use flutter module for an exits project
i want to use flutter but now is shelve
neiljaywarner commentedon Mar 5, 2019
@searchy2 @jiechic what is the output of flutter-doctor please? I just did file-new-project in intellij with Flutter (Channel stable, v1.2.1) and I get CompiledSDK 28 target SDK 28
I also get the same desired/good behaviour (target 28) with add2app .android directories recently created wit flutter 1.2.1
cc @matthew-carroll
although i would agree communication about it is very important please, e.g. https://github.com/flutter/flutter/wiki/Changelog and an entry on flutter.dev FAQ for Android developers or even more since the play store requirement is so urgent (august timeline) every year - so charting this item very carefully would be greatly appreciated.
"the other guys" have done poorly in this area so it would be great if flutter would do excellent in this area
rayliverified commentedon Mar 5, 2019
I'll create a new project from scratch and give it a try. Flutter has been giving me a lot of problems lately with Git and not committing the right files in .gitignore. Fingers crossed starting a new project will generate the correct file sdk targets.
jiechic commentedon Mar 6, 2019
@neiljaywarner

rayliverified commentedon Mar 10, 2019
Can verify that creating a brand new Android project and adding a new Flutter module does result in incompatible generated files with AndroidX.
neiljaywarner commentedon Mar 10, 2019
Would it be wise to update title? If Android x is the issue but api levels fine?
...
rayliverified commentedon Mar 10, 2019
Sure, what title do you think is more accurate?
neiljaywarner commentedon Mar 10, 2019
Just maybe please take out "target so 27 and" if they no longer apply
dnfield commentedon Mar 10, 2019
Android X is a bit thorny right now partly because of plugins. In the ecosystem, some plugins are migrated to Android X, others are not. Processes that we'd hope would assist with migrating automatically projects aren't quite working here. We're investigating this to try to figure out how to make the migration as painless as possible - but it's not quite there yet.
If you need this today, you'd have to migrate the template yourself, and then it's possible that you will have trouble using some plugins that have not yet migrated to Android X. The dependency interactions get kind of messy and TBH I'm not 100% clear on which configurations do and don't work at this point.
This is definitely on our radar, but I don't have a good notion right now for when we'll have it resolved.
/cc @mklim
12 remaining items
josh-burton commentedon Apr 12, 2019
I think the issue there is that there are still quite a few plugins that haven't updated to AndroidX yet.
Switching to AndroidX in the template would break compatibility.
Google build Jetifier for this exact reason - to rewrite the class files of dependencies to use AndroidX. The best fix here would be to get Jetifier working with the Flutter module.
noordawod commentedon Apr 13, 2019
Understood. So why not prepare a separate branch to be compatible with the upcoming AndroidX? That should be an easy task. Hell, I would submit a PR if the Flutter team would accept that as a viable route.
josh-burton commentedon Apr 14, 2019
I've created a PR (above) that adds support for AndroidX. It adds a new flag to the module section of a pubspec.yaml file which controls whether the generated files use AndroidX.
jiechic commentedon Apr 16, 2019
it's some wrong on PR build
have any update for after?
rayliverified commentedon Jun 2, 2019
Going to test this in Add 2 App and see if the issue is fixed. 🤞
blvckcoded commentedon Jun 7, 2019
Any luck on this working now? @searchy2
I have an existing android app with target and compile SDK version = 28. The project has been migrated to AndroidX.
Ran
flutter channel master(to get the PR merge fix by @athornz ,flutter upgradethen followed documentation here: https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
A) ran
flutter create --androidx -t module my_flutter<-- added the --androidx flag.This generates the flutter module and all other files within the project.
B) Updated my settings.gradle
C) Added the flutter module as an implementation dependency to my gradle
However, the pubspec.yaml file does not have this flag added: androidX: true. The generated java Flutter classes still use the old android support libraries.
Am I missing something here?
josh-burton commentedon Jun 7, 2019
@omid-io I've just created a small PR to fix that, but you can add the androidX flag manually and run
flutter packages getand the generated files will be updated to androidX.blvckcoded commentedon Jun 7, 2019
thanks @athornz, You Da Man! 👍 I'll try it out!
Adds the androidX flag to a modules pubspec.yaml template so it is se… (
rayliverified commentedon Oct 20, 2019
Keeping this issue open because there's still issues with converting an existing project to AndroidX.

AndroidX compatibility is still not enabled by default which means that new projects that are created needs to be converted to AndroidX. Unfortunately, the conversion process doesn't always work. When can AndroidX be enabled by default?
blasten commentedon Nov 4, 2019
AndroidX is the default now.
github-actions commentedon Aug 14, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.