Skip to content

AndroidX support #23586

Closed
Closed
@Bartosz-Kozajda

Description

@Bartosz-Kozajda

Steps to Reproduce

I wanted to add Flutter to my existing Android app. I've found this tutorial. I've created flutter module and my next step was to create FlutterFragment. Unfortunately my app is using AndroidX dependencies while Flutter is still using Android Support Libraries.

I think this is quite major issue because a lot of Android apps are using AndroidX already, moreover with the release of Android 9.0 (API level 28) all new library development will occur only in the AndroidX library.

Android Support artifacts are no longer supported.

Activity

added
platform-androidAndroid applications specifically
engineflutter/engine repository. See also e: labels.
on Oct 27, 2018
added this to the Goals milestone on Oct 27, 2018
added
toolAffects the "flutter" command-line tool. See also t: labels.
on Oct 27, 2018
gonzalonm

gonzalonm commented on Nov 28, 2018

@gonzalonm

really need this change! Any updates on this?

added
a: existing-appsIntegration with existing apps via the add-to-app flow
on Nov 29, 2018
leagmain

leagmain commented on Dec 4, 2018

@leagmain

I solved this issue by migrating the '.android' project to androidx using Android Studio, after that, I import flutter module to my project, and it works fine.

But remember one thing, don't delete .android project, cause flutter will re-generate one if it not exists.

dnfield

dnfield commented on Dec 20, 2018

@dnfield
Contributor

Working on making this easier to migrate to in the Engine - we just recently rolled to a newer Android support library, but haven't yet rolled to AndroidX.

Related to #17780

self-assigned this
on Jan 24, 2019
ssuarezh

ssuarezh commented on Jan 31, 2019

@ssuarezh

I cant migrate to AndroidX with AndroidStudio --> Refactor --> Migrate to AndroidX
I have this errors
screen shot 2019-01-30 at 11 45 52 pm

How i can migrate?

zoechi

zoechi commented on Jan 31, 2019

@zoechi
Contributor

About migration to AndroidX see also #27128 (comment)

issue from having the root of the Flutter app open in Android Studio instead of the Android subdirectory.

55 remaining items

added this to the August 2019 milestone on Jul 23, 2019
blasten

blasten commented on Aug 7, 2019

@blasten

An update on this issue:

If you encounter this issue, then run flutter config --enable-build-plugin-as-aar.

If you are building a full Flutter app

Run flutter build <apk/appbundle>. This fixes the AndroidX compatibility issue. The app must be using AndroidX, which is the result of creating the app flutter create -t app --androidx <app-directory>.

If you are building a Flutter module (Add to app)

Make sure the project is using AndroidX. e.g. flutter create -t module --androix <module-directory>. If the current project isn't using AndroidX, then edit the <module-directory>/pubspec.yaml, and add

module:
    androidX: true // This line

Next, remove the <module-directory>/.ios and <module-directory>/.android directories, so they get regenerated next time you use the Flutter tool.

blasten

blasten commented on Aug 23, 2019

@blasten

The remaining issue is discussed on #38988

Hixie

Hixie commented on Aug 28, 2019

@Hixie
Contributor

@blasten Does that mean we can close this bug? :-)

blasten

blasten commented on Aug 28, 2019

@blasten

Sounds good @Hixie. For anyone reading this thread, see #23586 (comment)

xuyisheng

xuyisheng commented on Apr 4, 2020

@xuyisheng

An update on this issue:

If you encounter this issue, then run flutter config --enable-build-plugin-as-aar.

If you are building a full Flutter app

Run flutter build <apk/appbundle>. This fixes the AndroidX compatibility issue. The app must be using AndroidX, which is the result of creating the app flutter create -t app --androidx <app-directory>.

If you are building a Flutter module (Add to app)

Make sure the project is using AndroidX. e.g. flutter create -t module --androix <module-directory>. If the current project isn't using AndroidX, then edit the <module-directory>/pubspec.yaml, and add

module:
    androidX: true // This line

Next, remove the <module-directory>/.ios and <module-directory>/.android directories, so they get regenerated next time you use the Flutter tool.

It's not work for me. I remove the .android and .ios directory, but when I regenerated them, it's just the same as before.

lock

lock commented on Apr 18, 2020

@lock

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.

locked and limited conversation to collaborators on Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: existing-appsIntegration with existing apps via the add-to-app flowc: API breakBackwards-incompatible API changescustomer: crowdAffects or could affect many people, though not necessarily a specific customer.dependency: androidAndroid team may need to help usengineflutter/engine repository. See also e: labels.p: toolingAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @abraham@xster@truongsinh@zoechi@Hixie

      Issue actions

        AndroidX support · Issue #23586 · flutter/flutter