私はXamarin Androidを初めて使用しています。私は自分のアプリケーションに基本的なGoogleマップを表示しようとしています。 APIキーなどがGoogleマップAPIに設定されています。しかし、私がエミュレータを起動すると、「Google Playサービスなしでアプリケーションは実行されません」というメッセージが表示されます。Xamarin AppはGoogle Playサービスなしでは実行されません
アンドロイドSDKマネージャを使用してすべてのパッケージ/ SDKをインストールしましたが、APIレベル22(Android 5.0 Lollipop)を使用しようとしています。
以下のコードは、Googleマップ(xamarinの例からダウンロード)を初期化するためのコードです。
誰でも私がここで何が欠けているか教えてください。
using System;
using Android.App;
using Android.Content;
using Android.Gms.Maps;
using Android.Gms.Maps.Model;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App2
{
[Activity(Label = "App2", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity, IOnMapReadyCallback
{
private GoogleMap _gMap;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
GetMap();
}
private void GetMap()
{
if (_gMap == null)
{
FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map).GetMapAsync(this);
}
}
public void OnMapReady(GoogleMap map)
{
_gMap = map;
}
}
}
Main.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment" />
アンドロイドMainfest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="App2.App2" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" />
<application android:label="App2" android:icon="@drawable/Icon">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCKBrF-_IrAQlkUyFG7GT4qgEJ7qOgyNRI" />
</application>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- We need to be able to download map tiles and access Google Play Services-->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allow the application to access Google web-based services. -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Google Maps for Android v2 will cache map tiles on external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- These are optional, but recommended. They will allow Maps to use the My Location provider. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
こんにちは、返信ありがとうございます。私はあなたの指示に従って、適切なzipファイルをダウンロードしましたが、問題はプレイヤーにドラッグをドロップできないことです。プレーヤーにジップをドロップしようとすると、サークル(禁止)アイコンが表示されます。これを引き起こしている可能性があります。 – Robin
ねえ!私は自分のシステムでそれを再現できるかどうかを確認する必要があります。私はこのスレッドに返信します。 – clb