0

Google マップに問題があります。マップが表示されず、次のような白いマップ タイルのみが表示されます: 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"/>

この問題を解決するアイデアはありますか?

4

4 に答える 4

2

Androidマニフェファイルのパッケージ名に問題があります:

これをチェックして:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android"
    android:versionCode="1"
    android:versionName="1.0" >

<permission android:name="com.kurtis.myapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
  <uses-permission android:name="com.kurtis.myapp.permission.MAPS_RECEIVE"/>

同じに修正します。

MAPS_RECEIVEあなたはそれがマップをどのように受け取るかについて異なる許可を追加しましたか?? に変更します

<permission android:name="com.example.android.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
      <uses-permission android:name="com.example.android.permission.MAPS_RECEIVE"/>
于 2013-04-02T10:38:13.917 に答える
0
  1. マニフェストのパッケージ名はすべきではあり:com.kurtis.myappませんcom.example.android

  2. class="com.google.android.gms.maps.MapFragment"レイアウトで使用してみてください

  3. Main Activity では、FragmentActivity ではなく Activity を使用して置き換えます
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);

    これとともに:

    mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);

これが役立つことを願っています

于 2013-04-02T10:41:28.740 に答える