我的谷歌地图有问题:没有地图出现,只有这样的白色地图图块:http: //oi47.tinypic.com/2uh0sk0.jpg
我试图生成一个新的 API 密钥,但它仍然不起作用,我不明白为什么......
这里是logcat:
04-02 11:04:07.459: W/dalvikvm(32502): VFY: unable to resolve virtual method 3693: Lcom/fullwipe/bolognacityguide/Mapexample;.getFragmentManager ()Landroid/app/FragmentManager;
04-02 11:04:07.499: W/dalvikvm(32502): VFY: unable to resolve instance field 23
04-02 11:04:07.859: W/dalvikvm(32502): Unable to resolve superclass of Lmaps/p/s; (425)
04-02 11:04:07.859: W/dalvikvm(32502): Link of class 'Lmaps/p/s;' failed
04-02 11:04:07.859: W/dalvikvm(32502): Unable to resolve superclass of Lmaps/y/bo; (3818)
04-02 11:04:07.859: W/dalvikvm(32502): Link of class 'Lmaps/y/bo;' failed
04-02 11:04:07.859: W/dalvikvm(32502): Unable to resolve superclass of Lmaps/i/k; (4206)
04-02 11:04:07.859: W/dalvikvm(32502): Link of class 'Lmaps/i/k;' failed
04-02 11:04:07.859: E/dalvikvm(32502): Could not find class 'maps.i.k', referenced from method maps.z.ag.a
04-02 11:04:07.859: W/dalvikvm(32502): VFY: unable to resolve new-instance 3538 (Lmaps/i/k;) in Lmaps/z/ag;
04-02 11:04:09.449: E/Adreno200-ES20(32502): **** 32547: glUseProgram(0)
04-02 11:04:10.109: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 0
04-02 11:04:10.109: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:10.119: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 1
04-02 11:04:10.119: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:11.869: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 0
04-02 11:04:11.949: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:11.979: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 1
04-02 11:04:11.999: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:12.069: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 0
04-02 11:04:12.089: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:12.199: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 1
04-02 11:04:12.199: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:12.239: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 0
04-02 11:04:12.249: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
04-02 11:04:12.279: E/Adreno200-EGLSUB(32502): Enter: GetBackBuffer(), surface: 0x2ca458, bufid: 1
04-02 11:04:12.299: E/Adreno200-EGLSUB(32502): Return: GetBackBuffer(), TRUE
显现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera"
android:required="false"/>
<uses-feature android:name="android.hardware.camera.any"
android:required="false" />
<permission android:name="com.kurtis.myapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.kurtis.myapp.permission.MAPS_RECEIVE"/>
<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"/>
<application
android:icon="@drawable/icona"
android:label="@string/app_name" >
<activity
android:name="com.kurtis.myapp.Home"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.kurtis.myapp.Mapexample"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaXXXXXXXXXXXXXXXXXXXXXXXXXq9M" />
</application>
</manifest>
活动:
package com.kurtis.myapp;
import com.example.android.R;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.SupportMapFragment;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
@SuppressLint("NewApi")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class Mapexample extends FragmentActivity {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapexample);
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
// The Map is verified. It is now safe to manipulate the map.
}
}
}
}
布局:
<?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"/>
你有解决这个问题的想法吗?