Error Inflating class com.google.android.maps.MapView

前端 未结 9 995
遇见更好的自我
遇见更好的自我 2020-11-30 13:45

i am just following a simple map tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html but getting this error . I am new to android i tried to f

相关标签:
9条回答
  • 2020-11-30 14:27

    Insert this on your xml declaration of the MapView

    xmlns:android="http://schemas.android.com/apk/res/android"
    
    0 讨论(0)
  • 2020-11-30 14:28

    I had the same problem and about 3 hours of searching this is what I did to fix it, All in the manifest.

    1) In my manifest this code was not in the right place

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

    it should be here, under

        <application>
    

    like this

        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="com.example.package.name">
          ...
          <application android:name="MyApplication" >
            <uses-library android:name="com.google.android.maps" />
            ...
          </application>
          ...
        </manifest>
    

    2) I lost a period somewhere in my manifest

        <activity 
            android:name="MyClass" //*****should be android:name=".MyClass"***
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MyClass />
    
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    

    3) I didn't specify min sdk version which goes under

        <manifest> 
    

    code:

        <uses-sdk android:minSdkVersion="7" />
    

    4) to get the map to work through eclipse in debug mode follow these directions in your cmd or terminal http://www.buzztouch.com/resources/Obtaining_a_Google_Maps_API_Key_v1.0.pdf

    I hope this helps someone

    0 讨论(0)
  • 2020-11-30 14:32

    to work with google maps in addition to use the tag

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

    in the tag, use another tag

    <uses-permission android:name="android.permission.INTERNET"/>
    

    inside the tag and you are done.

    But remember you should run this application in the AVD compatible with Google Inc. API but not with Android API.

    Another important thing is, be sure that you are using the MD5 API key instead of SHA1 or any other protocol API Key.

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