1

I'm having a problem while running my app, it says:

Plugin project :location_web not found. Please update settings.gradle.

I saw some videos, but anything about this :/

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"

Pubspec.yalm

name: teccar_project
description: A new Flutter project.

publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
    
  cupertino_icons: ^0.1.3
  google_fonts: ^1.1.1
  google_maps_flutter: ^1.0.3
  location: ^3.0.2
  flutter_svg: ^0.19.1
  url_launcher: ^5.7.8
  webview_flutter: ^1.0.5
  assets_audio_player: ^2.0.12

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

  assets:
    - assets/map_style.json
    - assets/driver.jpeg
    - assets/passenger.png
    - assets/square.svg
    - assets/uber_new_ride_alert.mp3

  • 1
    Can you share your settings.gradle file. This is build.gradle file. – Akif Oct 26 '20 at 20:48
  • This is the settings.gradle file, the directory is: **flutter_project_name\android\settings.gradle** –  Oct 26 '20 at 20:53
  • You may miss something. settings.gradle does not look like. It should be your build.gradle file. https://stackoverflow.com/a/61732682/10659482 – Akif Oct 26 '20 at 21:01
  • The same scenario happened to me while changing the minSdk – Upulie Han Jun 02 '21 at 07:41

1 Answers1

2

You need to load flutter-plugins. So, your settings.gradle file should look like:


include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

And your build.gradle file should look like:


def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

// Some more code...

Akif
  • 7,098
  • 7
  • 27
  • 53