1

このエラーが何度も発生し、xml ファイルのどこでこのエラーが発生したのかわかりません

?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

</LinearLayout>

そしてこちらが丸太猫

04-17 02:19:25.556: W/dalvikvm(731): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-17 02:19:25.586: E/AndroidRuntime(731): FATAL EXCEPTION: main
04-17 02:19:25.586: E/AndroidRuntime(731): java.lang.RuntimeException: Unable to start activity ComponentInfo{sbn.project.gp/sbn.project.gp.Mainevent}: android.view.InflateException: Binary XML file line #60: Error inflating class com.google.android.maps.MapView
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.os.Looper.loop(Looper.java:123)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-17 02:19:25.586: E/AndroidRuntime(731):  at java.lang.reflect.Method.invokeNative(Native Method)
04-17 02:19:25.586: E/AndroidRuntime(731):  at java.lang.reflect.Method.invoke(Method.java:521)
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-17 02:19:25.586: E/AndroidRuntime(731):  at dalvik.system.NativeStart.main(Native Method)
04-17 02:19:25.586: E/AndroidRuntime(731): Caused by: android.view.InflateException: Binary XML file line #60: Error inflating class com.google.android.maps.MapView
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.Activity.setContentView(Activity.java:1647)
04-17 02:19:25.586: E/AndroidRuntime(731):  at sbn.project.gp.Mainevent.onCreate(Mainevent.java:27)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-17 02:19:25.586: E/AndroidRuntime(731):  ... 11 more
04-17 02:19:25.586: E/AndroidRuntime(731): Caused by: java.lang.reflect.InvocationTargetException
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.google.android.maps.MapView.<init>(MapView.java:238)
04-17 02:19:25.586: E/AndroidRuntime(731):  at java.lang.reflect.Constructor.constructNative(Native Method)
04-17 02:19:25.586: E/AndroidRuntime(731):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-17 02:19:25.586: E/AndroidRuntime(731):  at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-17 02:19:25.586: E/AndroidRuntime(731):  ... 21 more
04-17 02:19:25.586: E/AndroidRuntime(731): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.google.android.maps.MapView.<init>(MapView.java:282)
04-17 02:19:25.586: E/AndroidRuntime(731):  at com.google.android.maps.MapView.<init>(MapView.java:255)

そして、これがAndroidマニフェストです

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tt.pp.ss"
    android:versionCode="1"
    android:versionName="1.0" >

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

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="com.google.android.maps" />
        <activity
            android:name=".SbnActivity"
            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=".Main"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="tt.pp.ss.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Db"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="tt.pp.ss.DB" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".View"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="tt.pp.ss.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
         <activity
            android:name=".Mainevent"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="tt.pp.ss.MAINEVENT" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Signup"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="tt.pp.ss.SIGNUP" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>

5時間以上費やしたヘルプはありませんが、理解できません。

4

2 に答える 2

3

以前にも同じ問題があり、次の2つの手順で解決しました。

1) AndroidManifest.xml ファイルの application (重要) 要素に次の行を追加します。

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

2) Activityの代わりにMapActivityを拡張します。

于 2012-04-30T10:16:48.967 に答える
3
MapViews can only be created inside instances of MapActivity.

MapActivity を使用していますか?

于 2012-04-17T00:33:16.617 に答える