gpt4 book ai didi

flutter - 插件项目 :location_web not found. 请更新 settings.gradle。我该如何解决?

转载 作者:行者123 更新时间:2023-12-03 02:38:50 25 4
gpt4 key购买 nike

我在我的 android flutter 应用程序中使用了 google maps api 和 location pub,dev 包,并尝试使用 api 中的 url 调出图像。
这是带有一些代码的网址:

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";
}
}
它抛出以下错误消息: Plugin project :location_web not found. Please update settings.gradle; 我不知道如何解决这个错误。
这是我在终端中收到的另一个错误:
I/flutter (21880): Invalid argument(s): No host specified in URI file:///Instance%20of%20'Future%3CString%3E'
我收到上述错误消息的区域在我的代码中:
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"),
],
);
}
}
这与我返回 Future<String> 的事实有关吗?而不仅仅是 string在我的 _getUserlocation功能?我怎么能解决这个问题?

最佳答案

使用以下 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将包含插件及其路径的文件。

关于flutter - 插件项目 :location_web not found. 请更新 settings.gradle。我该如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62348554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com