0

Androidプログラム/デバイスでGoogle Maps APIを表示する際に見つけたすべてのチュートリアルに従っていますが、動作させることができません。

最近の試行で、「アクティビティComponentInfoを開始できません」というランタイムエラーが発生しました

11-06 11:46:36.832: E/AndroidRuntime(24596): FATAL EXCEPTION: main
11-06 11:46:36.832: E/AndroidRuntime(24596): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maptest/com.example.maptest.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
11-06 11:46:36.832: E/AndroidRuntime(24596):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
11-06 11:46:36.832: E/AndroidRuntime(24596):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)

main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
    android:id="@+id/header"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world" />

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_below="@+id/header"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

助けてくれてありがとう。

4

2 に答える 2

0
Binary XML file line #17: Error inflating class fragment

おそらくあなたは使うべきです

class="com.google.android.gms.maps.MapFragment"

代わりに

android:name="com.google.android.gms.maps.MapFragment"
于 2013-11-06T13:12:57.150 に答える
0

私は同じことに直面し、マニフェストファイルに以下の行を追加することで解決しました。

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
于 2013-12-07T08:21:23.283 に答える