我是一名机器人学习者。我有一个与GoogleMap
相关的问题。当我打开应用程序时,我得到了空白的地图屏幕。
这是我的xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:orientation="vertical" >
<include layout="@layout/action_top_bar" />
<Spinner
android:id="@+id/city_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment
android:id="@+id/mapview_events"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment"
tools:layout="@layout/event_locator_screen" />
</LinearLayout>
这是我的错误:
02-10 03:09:02.324 5644-5708 /? E /谷歌地图API的Android: 授权失败。请参阅 https://developers.google.com/maps/documentation/android/start如何 正确设置地图。 02-10 03:09:02.324 5644-5708 /? E / Google Maps Android API:在Google Developer Console中 (https://console.developers.google.com) 确保已启用“Google Maps Android API v2”。 确保存在以下Android Key: API密钥:AIzaSyAlA9K-HAA6p2xBTQtQkdIX-PbjZkygqLA Android应用程序(;): EC:36:6A:04:B1:7A:02:C5:33:45:C6:AC:9E:AC:9F:AA:FE:14:1B:C0; com.example.ajay.hot
Manifest`
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<permission
android:name="com.example.ajay.hot.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.ajay.hot.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- Required OpenGL ES 2.0. for Maps V2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.ajay.hot.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.ajay.hot.MainActivity"
android:label="@string/main_title"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.JAboutScreen"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.MemberProfileScreen"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.JContactUs"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.AddEventActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
<activity
android:name="com.example.ajay.hot.JWebActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.JEventDetailsActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.EventLocatorActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.EventDirectonsActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<activity
android:name="com.example.ajay.hot.JSponsorsActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAlA9K-HAA6p2xBTQtQkdIX-PbjZkygqLA" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- Live android:value="AIzaSyCXOfQlLbtSYF9ztdGLyiAoBl6Ts5YQkxQ" /> -->
<!-- Test android:value="AIzaSyB7aB015Msr5ZhV_Su_ePSZIQtDzMo4Kz8" -->
</application>
`