Thang Luu
Thang Luu

Reputation: 31

Flutter location error with settings.gradle

I'm new to flutter and trying build a tracking location app. My flutter version is Flutter 1.18.0-7.0.pre.21 • channel master • https://github.com/flutter/flutter.git and flutter doctor is No issues found!. I use API Google map in my project and have google_map_package. . When I debug this app show the problem is Execution failed for task ':app:processDebugResources'.

Settings.gradle

include ':app'

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

Upvotes: 3

Views: 7724

Answers (1)

Apoorva Nataraja
Apoorva Nataraja

Reputation: 101

You are seeing this error because Android Studio doesn't know where Flutter is installed in your machine. You need to explicitly specify this in local.properties file like so:

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Fri Aug 14 13:14:39 PDT 2020
sdk.dir=C\:\\Users\\username\\AppData\\Local\\Android\\Sdk
flutter.versionName=1.2.0
flutter.sdk=C\:\\Users\\username\\flutter

Upvotes: 5

Related Questions