【问题标题】:main.XML have error for Google Mapsmain.XML 对谷歌地图有错误
【发布时间】:2012-07-26 11:03:34
【问题描述】:

这是我的 XML 文件:

<?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>

并且在 Ant 编辑器中显示问题出在此处:android:layout_height="fill_parent" > 但事实并非如此。 这是清单:

<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>

我试图清理一个项目,但仍然无法工作。当我尝试运行它时,它会在控制台中显示:XML 文件中的错误:正在中止构建。

并显示新的空白 XML 文件 ma​​in.out.xml...

我该怎么办? 我的 Main.java 没问题。问题出在 XML 中,可能是一些 Eclipse 错误,我不知道如何解决。请帮忙...

【问题讨论】:

  • 删除 main.out.xml 然后选择项目文件夹然后单击运行。当您尝试运行项目时请按照此操作(选择项目文件夹然后单击运行)
  • 你的api密钥在哪里??你没有生成??
  • 它的编译时间问题,map api key 不同

标签: android xml eclipse google-maps


【解决方案1】:

删除 ma​​in.out.xml 并清理您的项目表单Menu -&gt; Project -&gt; Clean

然后RightClick on Project -&gt; Run as -&gt; Android Application

【讨论】:

  • 我解决了。 :) 刚刚重新启动 Eclipse,现在它工作正常。 :)
猜你喜欢
  • 2016-05-09
  • 1970-01-01
  • 2015-12-24
  • 2016-11-24
  • 2015-06-16
  • 2014-08-18
相关资源
最近更新 更多