Android构建简单的用户界面错误

时间:2013-10-08 10:20:22

标签: android

我正在关注Android应用程序教程,我有这个错误,任何人都可以请帮助我,告诉我我做错了什么?我也使用android 4.3。我是Stack Overflow btw的新手很抱歉,如果我做了什么错。

这是我的代码:

 
    <LinearLayout 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:orientation="horizontal">

    <EditText android:id="@+id/edit_message"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send" />
</LinearLayout>

这是错误。

  [2013-10-08 10:02:01 - MyFirstApp] ------------------------------
    [2013-10-08 10:02:01 - MyFirstApp] Android Launch!
    [2013-10-08 10:02:01 - MyFirstApp] adb is running normally.
    [2013-10-08 10:02:01 - MyFirstApp] Performing com.example.myfirstapp.MainActivity activity launch
    [2013-10-08 10:02:02 - MyFirstApp] Automatic Target Mode: using device '015d4a5f6448220f'
    [2013-10-08 10:02:02 - MyFirstApp] Uploading MyFirstApp.apk onto device '015d4a5f6448220f'
    [2013-10-08 10:02:02 - MyFirstApp] Installing MyFirstApp.apk...
    [2013-10-08 10:02:05 - MyFirstApp] Success!
    [2013-10-08 10:02:05 - MyFirstApp] Starting activity com.example.myfirstapp.MainActivity on device 015d4a5f6448220f
    [2013-10-08 10:02:05 - MyFirstApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.myfirstapp/.MainActivity }
    [2013-10-08 10:16:10 - MyTestApp] ------------------------------
    [2013-10-08 10:16:10 - MyTestApp] Android Launch!
    [2013-10-08 10:16:10 - MyTestApp] adb is running normally.
    [2013-10-08 10:16:10 - MyTestApp] Performing com.example.mytestapp.FullscreenActivity activity launch
    [2013-10-08 10:16:11 - MyTestApp] Automatic Target Mode: using device '015d4a5f6448220f'
    [2013-10-08 10:16:11 - MyTestApp] Uploading MyTestApp.apk onto device '015d4a5f6448220f'
    [2013-10-08 10:16:11 - MyTestApp] Installing MyTestApp.apk...
    [2013-10-08 10:16:13 - MyTestApp] Success!
    [2013-10-08 10:16:13 - MyTestApp] Starting activity com.example.mytestapp.FullscreenActivity on device 015d4a5f6448220f
    [2013-10-08 10:16:13 - MyTestApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.mytestapp/.FullscreenActivity }
    [2013-10-08 10:33:04 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:35:02 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:35:26 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:35:27 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:36:55 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The markup in the document following the root element must be well-formed.
    [2013-10-08 10:36:55 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:37:11 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:38:16 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:40:08 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:40:56 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:41:03 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:41:23 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:41:45 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:41:56 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:43:20 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: XML version "4.3" is not supported, only XML 1.0 is supported.
    [2013-10-08 10:43:20 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:44:20 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: XML version "1" is not supported, only XML 1.0 is supported.
    [2013-10-08 10:44:20 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:45:58 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:46:43 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The XML declaration must end with "?>".
    [2013-10-08 10:46:43 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:47:01 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The XML declaration must end with "?>".
    [2013-10-08 10:47:01 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:47:29 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The markup in the document following the root element must be well-formed.
    [2013-10-08 10:47:29 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:47:39 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The markup in the document following the root element must be well-formed.
    [2013-10-08 10:48:16 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:49:54 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The element type "Button" must be terminated by the matching end-tag "</Button>".
    [2013-10-08 10:49:54 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:50:22 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: XML version "1" is not supported, only XML 1.0 is supported.
    [2013-10-08 10:50:22 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:50:40 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: XML version "1" is not supported, only XML 1.0 is supported.
    [2013-10-08 10:50:40 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:50:55 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 10:51:34 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The ' = ' character must follow "uses-sdk" in the XML declaration.
    [2013-10-08 10:51:34 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:51:41 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The ' = ' character must follow "uses-sdk" in the XML declaration.
    [2013-10-08 10:51:57 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The ' = ' character must follow "uses-sdk" in the XML declaration.
    [2013-10-08 10:51:57 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 10:52:35 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 11:02:41 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 11:03:01 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The markup in the document following the root element must be well-formed.
    [2013-10-08 11:03:01 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:07:06 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 11:07:54 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:07:54 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:08:00 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:08:00 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:08:11 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:08:11 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:08:18 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:08:18 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:08:35 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:08:35 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:08:42 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: The prefix "android" for attribute "android:minSdkVersion" associated with an element type "uses-sdk" is not bound.
    [2013-10-08 11:08:42 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:09:26 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.
    [2013-10-08 11:13:55 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Ethan\workspace\MyFirstApp\AndroidManifest.xml: XML document structures must start and end within the same entity.
    [2013-10-08 11:13:55 - MyFirstApp] Error in an XML file: aborting build.
    [2013-10-08 11:14:00 - MyFirstApp] AndroidManifest.xml does not declare a Java package: Build aborted.

1 个答案:

答案 0 :(得分:3)

我认为您的AndroidManifest.xml文件存在一些重大问题。在堆栈跟踪中,可以看到以下错误。我在一些错误旁边添加了斜体字注释。

  • 不支持XML版本“4.3”,仅支持XML 1.0。 - 应为<?xml version="1.0"?>
  • 不支持XML版本“1”,仅支持XML 1.0。 - 见上文
  • XML声明必须以“?&gt;”结尾。 - 见上文
  • 根元素后面的文档中的标记必须格式正确。
  • 元素类型“Button”必须由匹配的结束标记</Button>终止。 - 为什么清单文件中有一个按钮?
  • 与元素类型“uses-sdk”关联的属性“android:minSdkVersion”的前缀“android”未绑定。 - 您可能遗漏了xmlns:android="http://schemas.android.com/apk/res/android"
  • 等内容
  • '='字符必须遵循XML声明中的“uses-sdk”。 - 您可能遗漏了<uses-sdk android:minSdkVersion="7" />
  • XML文档结构必须在同一实体内开始和结束。

您能否发布清单文件的内容?

有关示例清单文件,请参阅this link