地图未加载

时间:2013-12-15 05:45:05

标签: android android-intent android-fragments

maps.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"
            android:name="com.google.android.gms.maps.MapFragment"/>

Maps.java

public class Maps extends FragmentActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.maps);
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.maps, menu);
            return true;
        }

    }

MAPS Mainfest

    

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <permission
        android:name="com.disp.maps.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <!--
     The following two permissions are not required to use
     Google Maps Android API v2, but are recommended.
    -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="com.disp.maps.permission.MAPS_RECEIVE" />

    <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" >
        <activity
            android:name="com.disp.maps.Maps"
            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.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyAXXXXXXXXXXXXXXXXXXXXXXXXX" />
    </application>

</manifest>

logcat的

12-15 00:31:33.240: D/dalvikvm(1590): GC_FOR_ALLOC freed 271K, 11% free 3011K/3356K, paused 41ms, total 45ms
12-15 00:31:33.530: E/Google Maps Android API(1590): Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
12-15 00:31:33.750: D/dalvikvm(1590): GC_FOR_ALLOC freed 261K, 10% free 3264K/3600K, paused 36ms, total 37ms
12-15 00:31:33.820: D/dalvikvm(1590): GC_FOR_ALLOC freed 28K, 10% free 3349K/3696K, paused 35ms, total 35ms
12-15 00:31:33.830: I/dalvikvm-heap(1590): Grow heap (frag case) to 3.947MB for 635812-byte allocation
12-15 00:31:33.880: D/dalvikvm(1590): GC_FOR_ALLOC freed 0K, 9% free 3970K/4320K, paused 49ms, total 49ms
12-15 00:31:34.120: W/TextureView(1590): A TextureView or a subclass can only be used with hardware acceleration enabled.
12-15 00:31:34.320: D/gralloc_goldfish(1590): Emulator without GPU emulation detected.
12-15 00:31:34.390: D/dalvikvm(1590): GC_FOR_ALLOC freed 110K, 6% free 4196K/4440K, paused 38ms, total 40ms
12-15 00:31:34.410: I/dalvikvm-heap(1590): Grow heap (frag case) to 5.431MB for 1324816-byte allocation
12-15 00:31:34.450: D/dalvikvm(1590): GC_FOR_ALLOC freed 1K, 5% free 5488K/5736K, paused 40ms, total 40ms

当我执行此代码时,会出现带有动物园输入和缩小选项的空白屏幕。我已经重新生成了API密钥,但结果仍然相同。我尝试了其他几种解决方案,并且我在Linux和窗口上尝试了这个应用程序,但同样的结果也是如此。

1 个答案:

答案 0 :(得分:0)

同时启用Google Maps Android API v2 Google Maps API v3服务。