Google Maps V2 - Error inflating class Fragment

后端 未结 15 1561
清歌不尽
清歌不尽 2020-12-03 01:04

I\'m trying my hand and Android Application Development. I\'m currently using Eclipse (I can\'t remember the version, whatever the newest is). I\'ve crossed a bridge where I

相关标签:
15条回答
  • 2020-12-03 01:14

    I know this is probably a dead thread but just in case someone stumbles upon here having an identical problem - your manifest might be missing the following meta information:

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

    Declare it within the <application> element and your code should work. I ran into the same issue following a youtube tutorial that skipped this step and only when carefully going through the original Google tutorial I noticed the missing code.

    Anyway, hope this helps someone.

    0 讨论(0)
  • 2020-12-03 01:14

    I had a similar error and I think it comes from this point: when I include the Google Play Service API I do not copy it in my workspace, I use the original one !!!

    Note: You should be referencing a copy of the library that you copied to your source tree—you should not reference the library from the Android SDK directory.

    Check this point.

    0 讨论(0)
  • 2020-12-03 01:14

    I have got similar problem that I resolved by right click project->tools>add support library ... and setup library

    I hope this help you

    0 讨论(0)
  • 2020-12-03 01:19

    using both meta data references was resolving the issue in my case:

    <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="yourAPIkeyFromGoogleAPIConsole" />
    
    0 讨论(0)
  • 2020-12-03 01:21

    I spend a lot of time trying to solve this problem and after much reading and trying, I solved by changing the

    public class MainActivity extends FragmentActivity

    for this

    public class MainActivity extends android.support.v4.app.FragmentActivity

    I hope this can help you

    0 讨论(0)
  • 2020-12-03 01:24

    In Some of android 6.0 mobile this exception is bug If unable to flat XML cause by

    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference
    

    Then it is active bug in android https://issuetracker.google.com/issues/35827842

    This can be solved by adding

    android:hardwareAccelerated="true" adding in activity tag
    
    0 讨论(0)
提交回复
热议问题