找不到插件项目:location_web.请更新settings.gradle.我该如何解决? [英] Plugin project :location_web not found. Please update settings.gradle. How do I fix this?

查看:67
本文介绍了找不到插件项目:location_web.请更新settings.gradle.我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的android flutter应用程序中使用了Google Maps api和location pub,dev包,并尝试使用api中的url来显示图像.这是带有一些代码的网址:

I was using the google maps api and location pub,dev package in my android flutter app, and tried to bring up an image using the url from the api. This was the url with some code:

class LocationHelper{
  static String mapviewpointer({double latitude, double longitude}){
    return "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=13&size=600x300&maptype=roadmap&markers=color:pink%7Clabel:C%7C$latitude,$longitude&key=$GOOGLE_API_KEY";
  }
}

它抛出了以下错误消息:

it threw the following error message:

插件项目:location_web找不到.请更新settings.gradle;

我不确定如何解决此错误.

I'm not sure how to fix this error.

这是我在终端中收到的另一个错误:

This was the other error I received in my terminal:

I/flutter (21880): Invalid argument(s): No host specified in URI file:///Instance%20of%20'Future%3CString%3E'

我上面的错误消息所在的区域在我的代码中:

The Area in which I get the error message above is here in my code:

Future <String> _getUserLocation() async{
  final locData = await Location().getLocation();
  final staticMapUrl = LocationHelper.mapviewpointer(
    latitude: locData.latitude, 
    longitude: locData.longitude,
    );
    return staticMapUrl;
}

final mapview = _getUserLocation();


class NearbyScreen extends StatelessWidget {
  @override
  //LocationHelper.mapviewpointer(latitude: )
  
  Widget build(BuildContext context) {
    return  Column(
            children: <Widget>[
              Container(height:170, width: double.infinity,
              child:Image.network(mapview.toString())
              ),
              Text("hello"),
            ],
          );
  }
}

这与我返回 _getUserlocation 中的 Future< String> 而不是仅返回 string 的事实有关吗?功能?我该如何解决?

Does it have something to do with the fact that I am returning a Future<String> instead of just a string in my _getUserlocation function? How could I fix this?

推荐答案

使用以下 settings.gradle :

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
}

这将创建一个 .flutter-plugin 文件,其中将包含插件及其路径.

This will create a .flutter-plugin file which will have the plugin and its path.

这篇关于找不到插件项目:location_web.请更新settings.gradle.我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆