应用程序只显示一个普通的皮肤色屏幕,而不是mapView。
我尝试过以下操作:
我已经遵循了本文档中的所有步骤
我已经在Google API控制台中启用了Google Maps Android API v2
我已经为android生成了一个API密钥。还尝试了几次创建。即使在不同的机器上
我已将Google play services
添加到我的项目中。我尝试将Custom debug keystore
设置为Default debug keystore
。我的AVD目标设置为Google API 17级。
Manifest.xml文件:
<permission
android:name="com.objectlounge.ridesharebuddy.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.objectlounge.ridesharebuddy.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<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" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
<uses-library android:name="com.google.android.maps"/>
我的活动和布局文件与本文档中的相同。
我使用模拟器我不确定模拟器中是否支持android mapView v2。
知道问题出在哪里吗?
确保您的活动扩展了FragmentActivity
而不是Activity
。
并用以下片段替换xml布局片段:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />