我是xamarin的新手,并致力于掌握基础知识。
一直关注本教程: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/map
从下面可以看出它看起来我可以请求,但我仍然有灰色瓷砖。什么可能导致这个?我的api密钥有问题吗?
public partial class MainPage : ContentPage
{
private StackLayout stackLayout = new StackLayout();
private Map map;
public MainPage()
{
InitializeComponent();
map = new Map(
MapSpan.FromCenterAndRadius(
new Position(35.184657, 33.353528), Distance.FromMiles(0.3)))
{
IsShowingUser = true,
HeightRequest = 100,
WidthRequest = 960,
VerticalOptions = LayoutOptions.FillAndExpand
};
stackLayout.VerticalOptions = LayoutOptions.FillAndExpand;
stackLayout.HorizontalOptions = LayoutOptions.FillAndExpand;
stackLayout.Children.Add(map);
Content = stackLayout;
}
调试输出
04-17 09:36:29.242 E/GoogleCertificates( 3601): Failed to load
com.google.android.gms.googlecertificates
04-17 09:36:29.242 E/GoogleCertificates( 3601): qq: No acceptable module found. Local version is 0 and remote version is 0.
04-17 09:36:29.242 E/GoogleCertificates( 3601): at com.google.android.gms.dynamite.DynamiteModule.a(:com.google.android.gms.DynamiteModulesB@11509470:11)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at in.a(:com.google.android.gms.DynamiteModulesB@11509470:12)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at in.a(:com.google.android.gms.DynamiteModulesB@11509470:31)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at in.b(:com.google.android.gms.DynamiteModulesB@11509470:30)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at iy.a(:com.google.android.gms.DynamiteModulesB@11509470:35)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at iy.a(:com.google.android.gms.DynamiteModulesB@11509470:20)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at com.google.maps.api.android.lib6.impl.ev.a(:com.google.android.gms.DynamiteModulesB@11509470:143)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at com.google.maps.api.android.lib6.impl.fb.run(:com.google.android.gms.DynamiteModulesB@11509470:28)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
04-17 09:36:29.242 E/GoogleCertificates( 3601): at java.lang.Thread.run(Thread.java:761)
答案 0 :(得分:2)
实际上,我认为如果您的API密钥错误,您将无法导航到地图页面。我在一两个星期前碰到了这个。查看应用程序输出,您应该看到有关“联系谷歌地图服务器”的消息