【问题标题】:What is the exact reason and resolution of "Error inflating class com.google.android.maps.MapView"“Error inflating class com.google.android.maps.MapView”的确切原因和解决方法是什么
【发布时间】:2011-05-07 18:43:04
【问题描述】:

这是我的 map.xml 文件中的内容:

<com.google.android.maps.MapView     
            android:id="@+id/mapView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:enabled="true"
            android:clickable="true"
            android:apiKey="0p8EoZESYekrClENQbOlN5EN16DgXv7Rx0CPTMg"            
            />

清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.apps.locid"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".LocID"
                  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=".Map"
                  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=".web_view"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="com.google.android.maps" />
    </application>
    <uses-sdk android:minSdkVersion="8" />

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



</manifest>

【问题讨论】:

标签: android


【解决方案1】:

您的日志(使用 logcat)或堆栈跟踪中没有更多内容?

【讨论】:

  • 这就是我在 logcat:11-10 15:05:15.853: ERROR/AndroidRuntime(1528): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.apps .locid/com.apps.locid.Map}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.maps.map
  • 问题已解决。忘记将我的课程扩展到 MapActivity。 :D 谢谢
【解决方案2】:

您是否将主类扩展为 MapActivity?

public class a extends MapActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-19
    • 2019-06-15
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 2020-09-08
    相关资源
    最近更新 更多