1

一个星期以来,我一直在解决这个问题,并且无法继续进行。我只得到一张空白地图的活动。

首先,我按照谷歌地图开发者网站上的说明进行操作,但没有成功。然后我尝试从google play服务mapdemo复制一些代码,仍然失败。为了制作 SupportMapFragment,我尝试了在这里和其他网站上找到的所有内容,但没有任何帮助。

google mapdemo 本身在我的调试设备(三星 s6500)上运行良好。

谢谢

日志猫:

07-21 22:12:33.819: W/dalvikvm(13123): VFY: unable to resolve instance field 27
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/p/w; (718)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/p/w;' failed
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/aq/as; (5347)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/aq/as;' failed
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/ag/l; (4576)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/ag/l;' failed
07-21 22:12:34.019: E/dalvikvm(13123): Could not find class 'maps.ag.l', referenced from method maps.ah.an.a
07-21 22:12:34.019: W/dalvikvm(13123): VFY: unable to resolve new-instance 4420 (Lmaps/ag/l;) in Lmaps/ah/an;
07-21 22:12:34.559: E/Adreno200-ES20(13123): **** 13302: glUseProgram(0)
07-21 22:12:34.759: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.759: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.769: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.769: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.779: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.779: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.799: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.799: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.819: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.819: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.839: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.839: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
.
.
.
....

显现:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="iOphir.mapapp"
    android:versionCode="1"
    android:versionName="1.0" >
   <permission
        android:name="iOphir.mapapp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="iOphir.mapapp.permission.MAPS_RECEIVE"/>
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <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-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"
        android:hardwareAccelerated="true" >
                   <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIza-----------"/>
        <activity
            android:name="iOphir.mapapp.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>
        <activity
            android:name="iOphir.mapapp.MapActivity"
            android:label="@string/title_activity_map" />
    </application>

</manifest>

活动

package iOphir.mapapp;

import iOphir.mapapp.R;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

public class MapActivity extends FragmentActivity {

    private GoogleMap mMap;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        setUpMapIfNeeded();

    }

    @Override
    protected void onResume() {
        super.onResume();
        setUpMapIfNeeded();

    }


    private void setUpMapIfNeeded() {
        // Do a null check to confirm that we have not already instantiated the map.
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment.
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map.
            if (mMap != null) {
                setUpMap();
            }
        }
    }


    private void setUpMap() {
        mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
    }
}

布局:

<?xml version="1.0" encoding="utf-8"?>

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
  android:id="@+id/map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.SupportMapFragment" />
4

1 回答 1

0

发现了问题。现在我觉得很笨。

我的包是 .mapapp,但是在 SHA-1 指纹之后,我输入它并以 .mappapp 结尾。

哦......我很高兴能克服它,但因为进入它而成为一个混蛋。

感谢任何尝试过的人。

于 2013-07-24T09:01:10.427 回答