1
votes

I'm trying to build a simple flutter application.

While trying to run the application in my android studio 3.0.1, the following error is displayed. Latest build tools and platform is installed.

Resolving dependencies... Finished with error:

  • Error running Gradle: Unable to download needed Android SDK components, as the following licenses have not been accepted: Android SDK Build-Tools 25.0.3, Android SDK Platform 25

To resolve this, please run the following command in a Terminal: flutter doctor --android-licenses

When tried to run the above code, the below-mentioned error is displayed.

Oops; flutter has exited unexpectedly.

Hope anyone can help me to resolve this. Thanks in advance.

4

4 Answers

1
votes

Change sdk.dir in local.properties

enter image description here Problem was with sdk path in local.properties. By default its pointing to different location. It works for me when change android sdk home dir in sdk.dir

0
votes

Try to change the location of SDK

Make sure its not in folder with spaces like C:\John Doe\SDK

Update your SDK and try again this command flutter doctor --android-licenses

0
votes
subprojects {
project.configurations.all {
    resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
                && !details.requested.name.contains('multidex') ) {
            details.useVersion "27.1.0"
        }
    }
}

}

It fixed for me by adding this to build.gradle in android folder.

0
votes

try running

flutter doctor --android-licenses 

If the problem still exists Make sure your sdk is not in folder with spaces like C:\Windows\Users\Rahul Raj\Android\SDK Even If The Problem exists try checking the environment variable ANDROID_HOME shows your sdk path