denelan
denelan

Reputation: 143

Androidx error creating new flutter project in Android Studio

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?

Upvotes: 14

Views: 8796

Answers (6)

Jirachai Thiemsert
Jirachai Thiemsert

Reputation: 1

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

Upvotes: 0

hatted
hatted

Reputation: 1597

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

flutter upgrade --force

Upvotes: 3

Ahmed.Raafat
Ahmed.Raafat

Reputation: 1

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.

Upvotes: 0

Oleksandr
Oleksandr

Reputation: 1863

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.

Upvotes: 2

Dakatine
Dakatine

Reputation: 2743

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.

Upvotes: 25

pasanbuddhika
pasanbuddhika

Reputation: 526

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

Upvotes: 2

Related Questions