14

When I want to start a new Flutter Project in Android Studio (3.5.1.) I get the following event:

Error creating project. Could not find an option named "androidx". Empty folders are created, but no project.

I've not set anything to needing androidx and I've updated everything I could in Android Studio.

How do I get around this error?

6 Answers 6

25

There's an accepted answer already but to me the way to solve that was very different, so I still post it hoping for it to be useful to someone.

In my case, I just had to update flutter. To do so, I ran

flutter upgrade

from the command line. That took a few minutes. Afterwards I was able to create a Flutter project from Android Studio flawlessly.

Sign up to request clarification or add additional context in comments.

1 Comment

flutter upgrade can result in a crash, but despite that the project was created successfully...??? Now there is a head scratcher.
3

Due to no upgrade for a long while, I need to upgrade the flutter by running the following command in terminal:

flutter upgrade --force

1 Comment

--force option is not available for all flutter versions. If someone comes here with an old flutter version, try without --force flag
2

First, update the Gradle version in build.gradle file in the root of android folder to 3.5.1.

Then update test dependencies in build.gradle file in the android/app/ directory to androidx as follws.

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

And update distributionUrl in android/gradle/wrapper/gradle-wrapper.properties to

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

1 Comment

My pleasure @denelan
2

Download a newver version of Flutter SDK from the Flutter official website and replace the old version on your hard drive with it. I worked for me.

2 Comments

If you are like me and coming from version 1.0, flutter upgrade won't work, it doesn't even recognize the --force option. This is the best way forward, worked perfectly.
flutter upgrade didn't work for me. This did, thanks!
0

Download a newer version of Flutter SDK from https://flutter.dev/docs/get-started/install and replace the old version on your hard drive with it. I worked for me.

Comments

0

On Android Studio 4.0, try to create a new flutter project. And then install the new flutter SDK. It should fix this issue.

1 Comment

Just letting you know, in the question it referring to the Android Studio 3.5.1. Would it still work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.