没有看到从MapActivity扩展的地图

时间:2013-04-19 22:27:28

标签: android maps tiles google-maps-api-2

  • 当我将APK上传到设备中时,我看不到地图。
  • 我尝试过FragmentActivity,我可以毫无问题地看到地图,但在这种情况下使用MapActivity不会。
  • Google Maps Android API v2服务已启用。 任何的想法?提前谢谢!

CODE:

package com.avargas.mapas2;

import android.os.Bundle;
import android.view.Menu;
import com.avargas.mapas2.R;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity {

    private MapView mapa;

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

        mapa = (MapView) this.findViewById(R.id.mapview);
        mapa.setBuiltInZoomControls(true);
        mapa.setTraffic(true);
    }

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

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

}

ACTIVITY XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:apiKey="AIzaSyCkYNO20ZR0rNTkF-O7g-i0e54SIsU1W5s"/>

</RelativeLayout>

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.avargas.mapas2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

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

       <permission
        android:name="com.avargas.mapas2.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.INTERNET"/>

    <uses-permission android:name="com.avargas.mapas2.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <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-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />   
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <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.avargas.mapas2.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="AIzaSyCkYNO20ZR0rNTkF-O7g-i0e54SIsU1W5s"/>
    </application>

</manifest>

API:

API key:    
AIzaSyCkYNO20ZR0rNTkF-O7g-i0e54SIsU1W5s
Android apps:   
8F:AA:26:71:BC:77:61:A3:34:1C:55:DC:46:AE:BD:35:97:50:A5:22;com.avargas.mapas2
Activated on:   Apr 19, 2013 2:58 PM
Activated by:   you

0 个答案:

没有答案