Google Map is not loading due to inflate exception

前端 未结 3 1573
無奈伤痛
無奈伤痛 2021-01-17 02:29

I am using Google Maps v2 in my application. The key is correctly generated, all the permissions exist in manifest. I followed the tutorial of Google Maps v2. I followed eac

相关标签:
3条回答
  • 2021-01-17 02:55

    I think your package name and the permission tag package names are differing I think and even this android:name="com.appscourt.jooging.track.map.health.MainActivity" try to verify

    0 讨论(0)
  • 2021-01-17 03:09

    Your logcat clearly said

     03-04 01:25:23.293: E/AndroidRuntime(19467): Caused by:
     java.lang.IllegalStateException: The meta-data tag in your app's
     AndroidManifest.xml does not have the right value.  Expected 4242000
     but found 0.  You must have the following declaration within the
     <application> element:     <meta-data
     android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" /> 03-04
     01:25:23.293: E/AndroidRuntime(19467):
    

    Add the Google Play services version to your app's manifest

    Edit your application's AndroidManifest.xml file, and add the following declaration within the element. This embeds the version of Google Play services that the app was compiled with.

    You need to add <meta-data> under <application> tag into your AndroidManifest.xml

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

    This is because latest google play services requires a version name, which is to be mentioned using <meta-data .. /> inside AndroidManifest.xml

    and also change MainActivity extends Activity

    For more information go to :https://developers.google.com/maps/documentation/android

    0 讨论(0)
  • 2021-01-17 03:21

    if you are using android-support-v4.jar (for backward support) then try SupportMapFragment

    replace this line class="com.google.android.gms.maps.MapFragment"

    with class="com.google.android.gms.maps.SupportMapFragment"

    and also put in manifest.xml

     <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="YOUR_API_KEY" />
     <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    
    0 讨论(0)
提交回复
热议问题