Android GoogleMap v2无法在API 14下运行

时间:2014-10-24 07:07:18

标签: android google-maps

我正在使用GoogleMap Android v2。

当我使用Android API级别14进行编译时,Google地图运行良好。 但是当我在API级别13下使用时,Map不会显示(空白)。 GoogleMap是否需要14级?

以下是我的Manifest.xml

由于

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

<uses-sdk android:minSdkVersion="**14**" />
<uses-feature android:glEsVersion="0x00020000" />

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

    <uses-permission android:name="com.exa.permission.MAPS_RECEIVE" />  
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />   
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE"/>     
    <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" /> 

<supports-screens android:largeScreens="true"
                  android:smallScreens="true"
                  android:anyDensity="true"
                  android:normalScreens="true"/>
<application android:label="@string/app_name" android:allowBackup="true"
             android:icon="@drawable/icon">
    <uses-library android:name="com.google.android.maps" />         

    <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="API KEY HERE"/>

    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/applicationId" />

    <activity android:name="Test"
              android:label="@string/app_name"
              android:screenOrientation="portrait"
              android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
              android:configChanges="orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>                        
</application>     
</manifest> 

MainActivity.java

protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    mapView = LayoutInflater.from(this).inflate(R.layout.map_view, null);
    mapView.setPadding(0, 0, 0, 0);
    addContentView(mapView, new LayoutParams(400, 400));    

    mMapFragment = MapFragment.newInstance();
    FragmentManager fragmantManager = getFragmentManager();
    FragmentTransaction transaction = fragmantManager.beginTransaction();
    transaction.add(R.id.container, mMapFragment); 
    transaction.commit();
}

0 个答案:

没有答案