android google map v.2 : android.view.InflateException: Binary XML file line #739: Error inflating class fragment

前端 未结 2 1352
生来不讨喜
生来不讨喜 2021-01-22 14:39

I found similar topics in stackoverflow but it didn\'t help for me. I want to show map, but when i run it, it return force close. Here are the codes :

map = ((Ma         


        
相关标签:
2条回答
  • 2021-01-22 14:54

    I got the same exception as well, but I figured out for Google API v2 to work, you must include these permissions

        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    

    I hope this will help you guys.

    P.S I used these permissions for adding a simple map in my app. There are certain other permissions which this link suggests as well.

    0 讨论(0)
  • 2021-01-22 15:00

    The logcat is clear

    You need to add the below to manifest file

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

    https://developers.google.com/maps/documentation/android/start#add_the_google_play_services_version_to_your_apps_manifest

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

    0 讨论(0)
提交回复
热议问题