简体   繁体   中英

Android | Google Maps API

Today I've been updating my android app but this isn't going as expected. I'm using google maps and after the update I don't get it to work anymore. I got another API key and everything.. Now the difference is I used Google APIs 4.2.2 and after today 4.4

Could it be that the code to display a Google Map changed in these APIs? Is there a way to keep track of the changes and if yes where?

In the old app where it works I use following code in an XML file to display a map

<fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_below="@id/upper"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

================================================

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="18" />

    <permission
        android:name="be.khk.mmapp.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <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" />
    <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/mm_icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="be.khk.mmapp.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="be.khk.mmapp.NewsActivity"
            android:label="@string/news_activity" >
        </activity>
        <activity
            android:name="be.khk.mmapp.RetailersActivity"
            android:label="@string/retailers_activity" >
        </activity>
        <activity
            android:name="be.khk.mmapp.VoucherActivity"
            android:label="@string/voucher_activity" >
        </activity>
        <activity
            android:name="be.khk.mmapp.AboutUsActivity"
            android:label="@string/aboutus_activity" >
        </activity>
        <activity
            android:name="be.khk.mmapp.RetailerActivity"
            android:label="@string/retailer_activity" >
        </activity>
        <activity
            android:name="be.khk.mmapp.ContactActivity"
            android:label="@string/contact_activity" >
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <uses-library android:name="com.google.android.maps" />

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyBnVb**************************6pUvk" />
    </application>

</manifest>

If anyone could lead me in the right direction that would be nice.

The Google Maps SDK is stored in Google Play Services and is updated independently from the Android OS. What phone are you using? If you flashed a custom ROM, make sure it has Google Play Services. Can you also provide your AndroidManifest?

EDIT: check logcat for authorization failure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM