简体   繁体   中英

main.XML have error for Google Maps

This is my XML file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.google.android.maps.MapView
          android:id="@+id/mvMain"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 android:clickable="true"
                 android:apiKey="MAP API KEY" />
</RelativeLayout>

and in Ant Editor is showing that the problem is here: android:layout_height="fill_parent" > but it isn't. And this is Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.natasamisic.maptest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
         android:theme="@android:style/Theme.NoTitleBar">
        <uses-library android:name="com.google.android.maps" />
        <activity
            android:name=".Main"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

I tried to clean a project and still won't work. When I try to run it, it shows this in console:Error in an XML file: aborting build.

and displays new blank XML file main.out.xml ...

What should I do? My Main.java is ok. Problem is something in XML, maybe some Eclipse bug, I don't know how to solve it. Please help...

delete main.out.xml and clean your project form Menu -> Project -> Clean

and then RightClick on Project -> Run as -> Android Application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM