2013-10-08 52 views
-1

我正在關注android應用教程,我有這個錯誤,任何人都可以請幫助我,告訴我我做了什麼錯?還有我正在使用android 4.3.I新來堆棧溢出btw很抱歉,如果我做錯了什麼。Android構建一個簡單的用戶界面錯誤

這裏是我的代碼:

<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. 
+0

發佈您的AndroidManifest.xml –

+0

您的清單中存在錯誤。請發佈您的androidmanifest.xml –

+0

確保您在清單文件中添加了活動 –

回答

3

我認爲你的AndroidManifest.xml文件存在一些主要問題。在堆棧跟蹤中,可以看到以下錯誤。我在一些錯誤旁邊添加了一些斜體的評論。

  • 不支持XML版本「4.3」,只支持XML 1.0。 - 應該是<?xml version="1.0"?>
  • 不支持XML版本「1」,只支持XML 1.0。 - 見上面
  • XML聲明必須以「?>」結尾。 - 見上面
  • 跟在根元素之後的文檔中的標記必須是格式良好的。
  • 元素類型「Button」必須由匹配的結束標記</Button>終止。 - 爲什麼你的清單文件中有一個按鈕?
  • 與元素類型「uses-sdk」關聯的屬性「android:minSdkVersion」的前綴「android」未綁定。 - 在XML聲明你可能會失去了一些東西像xmlns:android="http://schemas.android.com/apk/res/android"
  • 的「=」字符必須遵循「使用-SDK」。 - 您可能會錯過<uses-sdk android:minSdkVersion="7" />
  • XML文檔結構必須在同一個實體中開始和結束。

您可以發佈您的清單文件的內容嗎?

請參閱this link獲取Manifest文件示例。

相關問題