我正在使用谷歌地图制作Android应用程序: -
我的步骤: -
Fragment activity
问题: - 我在屏幕上看到一个带有放大和缩小按钮的空白地图
这是我的代码: -
activity_main.xml中: -
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/spr_place_type"
/>
AndroidManifest.xml: -
<uses-permission android:name="android.permission.INTERNET"/>
<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.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<permission
android:name="com.strangeworld.locations.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library
android:name="com.google.android.maps"/>
<activity
android:name="com.strangeworld.locatorapp.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD2LVShEdbQWWV4......"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
Log cat: -
01-10 10:33:28.059: E/dalvikvm(2440): Could not find class 'maps.ae.i', referenced from method maps.af.al.a
01-10 10:33:30.039: E/GooglePlayServicesUtil(2440): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-10 10:33:32.909: E/Google Maps Android API(2440): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
01-10 10:33:32.929: E/Google Maps Android API(2440): Ensure that the following correspond to what is in the API Console: Package Name: com.example.locations, API Key: AIzaSyAZhJllASbTnr......, Certificate Fingerprint: 83033D1ECACA2C88F9AA2.....
答案 0 :(得分:0)
您的密钥库在google api控制台中不合适或包名称错误,请重新检查一次。
答案 1 :(得分:0)
您使用的是哪种类型的密钥库?如果使用调试密钥,则发布的地图看起来为空白。使用发布密钥发布。
Google Map Android API v2 can't display map in play store application
答案 2 :(得分:0)
在分号后用密钥提及整个包名称即。 com.abcdm.locatorapp
答案 3 :(得分:0)
While generating the key do i need to spicify the whole package name i.e. com.abcdm.locatorapp or just com.abcdm
是的,您需要在google api控制台中提及包名称
SHA;complete packagename
也尝试重新生成密钥
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included
您需要正确引用Google Play服务。检查一下
Importing google-play-service library showing a red X next to this reference android