【发布时间】:2013-08-19 00:13:13
【问题描述】:
我是 Android 开发新手。我正在使用 ADT 插件运行 Eclipse 并安装了所有必要的依赖项。我打开 Eclipse,选择“New Android Applciation”,一切都设置好了。当我运行应用程序时,我收到一条错误消息,提示
/home/parallels/workspace/test/AndroidManifest.xml: 2: /home/parallels/workspace/test/AndroidManifest.xml: Syntax error: newline unexpected
所以我查看了 Android Manifest,它只是默认的 Eclipse 生成的代码,对吧?这里有什么问题?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.test.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
【问题讨论】:
-
旧版本的 ADT 插件对我来说存在问题,即在 XML 文件中获取错误的换行符终止符。我可以解决问题的唯一方法是打开文件(在 Eclipse 中),删除换行符,然后按 Enter。我不知道在这种情况下“错误”的换行符终止符是什么,但我自己按 Enter 是我修复它的方法。
-
嗯。这正是我在生成新项目时得到的。它适用于我,所以我不确定问题是什么。
-
您使用的是 Linux 还是 Windows?
-
我不确定清洁是否会在这种情况下有所帮助,但值得一试。 “项目 --> 清理...”
标签: java android eclipse ubuntu