当我的Xamarin表单应用程序运行时,它已经停止了?
我为Android创建一个以Xamarin形式的空白应用程序。当我在模拟器中运行空白应用程序时,但是当将xamarin.form.googlemaps添加到我的页面并在模拟器显示错误中运行时,
错误消息=“应用程序已停止”
我做了以下操作来添加xamarin.form.googlemaps。
1-从Nuget下载最新版本Xamarin.form.googlemaps。
2-添加
&lt; meta-data android:name =“ com.google.android.maps.v2.api_key” android:value =“我的api键” /&gt; < /code> to androidmanifest.xml >
3-添加我需要的所有许可!许可列表
&lt; use-permission android:name =“ android.permission.access_network_state” /&gt; < /code>
&lt
&lt;允许.access_coarse_location“ /&gt; < /code>
&lt; use-permission android:name =“ android.permission.access_fine_location” /&gt; < /code>
&lt; use-permission android:name =“ android.permision.access_location_extra_extra_extra_extra_commands” /
&lt;用法permission android:name =“ android.permission.access_mock_location” /&gt; < /code>
&lt; use-permission android:name =“ android.permision.access_wifi_state”
&lt; use-permission android:name =“ android.permission.internet” /&gt; < /code>
&lt; use-permission android:name =“ android.permission.write_extern_storage” /&gt; < /code>
4-添加 xmlns:maps =“ clr-namespace:xamarin.forms.googlemaps; assembly = xamarin.forms.googlemaps”
到我的页面
5-
5-
&lt ;地图:Map verticaloptions =“填充” MorizontalOptions =“ fill”/&gt;
朋友,我该如何解决关闭该应用程序的问题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您缺少Android项目中的插件初始化。
You are missing the plugin initialization in the Android project.
首先,您可以下载Android Studio并检查模拟器中的日志,以查找出现哪种类型的错误并导致应用程序崩溃。
此外,GitHub中的Nuget软件包已经有一个样本,您是否尝试过?
最后,在第四步中,您不仅需要将这些权限添加到AndroidManifest.xml中,而且还需要用户授予危险的权限,例如自己的位置许可。
因此,您可以根据官方文件进行运行时许可检查并申请许可: https://learn.microsoft.com/en-us/xamarin/android/App-fundamentals/permissions?tabs=windows
和
At first, you can download the android studio and check the log in the emulator to find what type of error appears and causes the app crash.
In addition, there is already a sample in the github for this nuget package, have you tried that?
Finally, at the 4th step, you not only need to add these permissions into the AndroidManifest.xml, but also need the user to grant the dangerous permissions such as the location permission by himself.
So you can do a run-time permission check and request the permission according to the official document:https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/permissions?tabs=windows
and https://learn.microsoft.com/en-us/xamarin/essentials/permissions?tabs=android