如何解决此“由于未授予位置权限而无法启用MyLocation层"? [英] How to resolve this "Cannot enable MyLocation layer as location permissions are not granted"?
问题描述
我在颤振页面中包含了一个简单的GoogleMap组件,只是为了查看它是否有效,但我无法解决此问题.我编译了应用程序,当我导航到该页面时,在控制台中出现以下错误:
I have included in my flutter page a simple GoogleMap component only to see if it works but I can't resolve this problem. I compile the application and when I navigate to the page I get the following error in the console:
"E/GoogleMapController(3376):由于未授予位置权限,因此无法启用MyLocation图层"
"E/GoogleMapController( 3376): Cannot enable MyLocation layer as location permissions are not granted"
我可以看到该组件,但看不到地图(请参见图片):
I can see the component but I'm not able to see the map (see the image):
添加的配置:
//(AndroidManifest.xml)
<meta-data android:name="com.google.android.geo.API_KEY" android:value="apikey"/>
//(pubspec.yaml)
google_maps_flutter: ^0.5.0
编辑-解决方案
添加权限包以请求权限.您可以安装此软件包来管理权限: https://pub.dartlang.org/packages/permission
Add the permission package to request permission. You can install this package to manage your permissions: https://pub.dartlang.org/packages/permission
推荐答案
android.permission.ACCESS_FINE_LOCATION
被视为危险许可.您是否使用过 permission
包来请求许可? https://pub.dartlang.org/packages/permission
android.permission.ACCESS_FINE_LOCATION
is considered a dangerous permission. Have you used the permission
package to request the permission? https://pub.dartlang.org/packages/permission
这篇关于如何解决此“由于未授予位置权限而无法启用MyLocation层"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!