2016-04-28 470 views
1

我需要将工作项目从Eclipse导入到Android Studio 2.1,从摇篮控制台Android错误 - AGPBI:{“kind”:“error”,“text”:“解析XML时出错:格式不正确(无效标记)”

执行的任务的以下消息:[:应用程序:generateDebugSources,:应用程序:mockableAndroidJar,:应用程序:prepareDebugUnitTestDependencies,:应用程序:generateDebugAndroidTestSources]

配置上的需求是一个培养特征。 增量Java编译是一项孵化功能。 :应用程序:预生成UP-TO-DATE :应用程序:preDebugBuild UP-TO-DATE :应用程序:checkDebugManifest :应用程序:preReleaseBuild UP-TO-DATE :应用程序:prepareComAndroidSupportAnimatedVectorDrawable2330Library :应用程序:prepareComAndroidSupportAppcompatV72330Library :应用程序:prepareComAndroidSupportSupportV42330Library :应用程序:prepareComAndroidSupportSupportVectorDrawable2330Library :应用程序:prepareDebugDependencies :应用程序:compileDebugAidl :应用程序:compileDebugRenderscript :应用程序:generateDebugBuildConfig UP-TO-DATE :应用程序:mergeDebugShaders UP-TO-DATE :应用程序:compileDebugShaders :应用:generateDebugAssets :应用:mergeDebugAssets UP-TO-DATE :应用:generateDebugResValues UP-TO-DATE :应用程序:generateDebugResources :应用程序:mergeDebugResources :应用程序:processDebugManifest :应用:processDebugResources AGPBI:{“样“:”error“,”text“:”解析XML时出错:格式不正确(无效标记)“,”sources“:[{”file“:”C:\ Users \ advanchip \ StudioProjects \ Mobile-ControlledLighting \ app \ SRC \主\ RES \布局\ dialog_add_gateway.xml”, “位置”:{ “STARTLINE”:0}}], “原”: “”, “工具”: “AAPT”}

FAILED

失败:生成失败并出现异常。

  • 出了什么问题: 执行失败的任务 ':应用程序:processDebugResources'。

    com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程 '命令' C:\用户\ advanchip \应用程序数据\本地\的Android \ SDK \构建工具\ 23.0.3 \ aapt.exe'完成与非零退出值1

  • 尝试: 与--stacktrace选项获取堆栈跟踪运行。使用--info或--debug选项运行以获取更多日志输出。

构建失败

总时间:12.676秒

The codes of the xml file is 

<!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (LinearLayout|Spinner|EditText|Button)*><!ATTLIST LinearLayoutandroid:background CDATA #IMPLIEDandroid:gravity CDATA #IMPLIEDandroid:id CDATA #IMPLIEDandroid:layout_height CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #IMPLIEDandroid:paddingLeft CDATA #IMPLIEDandroid:paddingRight CDATA #IMPLIEDandroid:paddingTop CDATA #IMPLIEDxmlns:android CDATA #IMPLIEDxmlns:tools CDATA #IMPLIED><!ELEMENT Spinner (#PCDATA)><!ATTLIST Spinnerandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:maxLines CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED><!ELEMENT EditText (#PCDATA)><!ATTLIST EditTextandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:hint CDATA #REQUIREDandroid:maxLines CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:singleLine CDATA #REQUIREDandroid:textColor CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED><!ELEMENT Button (#PCDATA)><!ATTLIST Buttonandroid:background CDATA #REQUIREDandroid:id CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIRED>]> 
<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:background="#011f4b" 
    android:gravity="center_horizontal" 
    android:orientation="vertical" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" > 

    <LinearLayout 
     android:id="@+id/add_gateway_form" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <Spinner 
      android:id="@+id/gatewaySerial" 
      android:layout_width="match_parent" 
      android:layout_height="40sp" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="20sp" 
      android:background="@drawable/rect_text_edit" 
      android:maxLines="1" 
      android:paddingBottom="5dp" 
      android:paddingTop="5dp" 
      android:textStyle="bold" 
      /> 

     <EditText 
      android:id="@+id/gatewayName" 
      android:layout_width="match_parent" 
      android:layout_height="40sp" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="10sp" 
      android:background="@drawable/rect_text_edit" 
      android:hint="Gateway Name" 
      android:maxLines="1" 
      android:paddingBottom="5dp" 
      android:paddingLeft="5dp" 
      android:paddingRight="5dp" 
      android:paddingTop="5dp" 
      android:singleLine="true" 
      android:textColor="#008bcb" 
      android:textStyle="bold" /> 

     <Button 
      android:id="@+id/add_gateway_button" 
      android:layout_width="200sp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="16dp" 
      android:background="@drawable/submit_button_bg" 
      android:text="Create Gateway" 
      android:textSize="18sp" /> 

     <Button 
      android:id="@+id/dialog_cancel" 
      android:layout_width="200sp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="16dp" 
      android:background="@drawable/submit_button_bg" 
      android:text="Cancel" 
      android:textSize="18sp" /> 
    </LinearLayout> 

</LinearLayout> 

的应用程序的构建的代码。gradle这个是

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 
    useLibrary 'org.apache.http.legacy' 

    defaultConfig { 
     applicationId "com.advanchip.mobile_controlledlighting" 
     minSdkVersion 17 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    productFlavors { 
    } 
} 

dependencies { 
    //compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:support-v4:23.3.0' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    //compile 'com.android.support:support-v4:22.2.0' 
    //compile 'com.android.support:appcompat-v7:22.2.0' 
    //compile "com.android.support:support-v4:18.0.+" 
    //compile "com.android.support:appcompat-v7:18.0.+" 
    compile files('libs/commons-lang-2.6.jar') 
    compile files('libs/commons-logging-1.1.2.jar') 
    compile files('libs/httpmime-4.0.1.jar') 
    compile files('libs/smartconfiglib.jar') 
} 

The image of Android SDK Manager

The codes of rect_text_edit.xml 

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 

    android:shape="rectangle" > 

    <solid android:color="#ffffff" /> 



</shape> 


    The codes of submit_button_bg.xml 

<?xml version="1.0" encoding="utf-8"?> 

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:state_pressed="true" 
     android:drawable="@color/button_pressed" /> 

    <item android:state_enabled="true" 
     android:drawable="@color/button_normal" /> 
</selector> 


    Please advise, thanks. 
+0

发表您的submit_button_bg和rect_text_edit文件。并删除<!DOCTYPE行.. –

+0

submit_button_bg.xml <?xml version =“1.0”encoding =“utf-8”?> <项机器人:state_pressed =” 真 “ 机器人:抽拉= ”@颜色/ button_pressed“/> <项机器人:state_enabled = ”真“ 机器人:抽拉=” @ color/button_normal“/> advanchip

+0

rect_text_edit.xml <?xml version =”1.0“encoding =”utf-8“?> <固体机器人:颜色= “#FFFFFF”/> advanchip

回答

0

。在你的XML行是无关紧要删除以下行 <!DOCTYPE LinearLayout [<!ELEMENT LinearLayout (LinearLayout|Spinner|EditText|Button)*><!ATTLIST LinearLayoutandroid:background CDATA #IMPLIEDandroid:gravity CDATA #IMPLIEDandroid:id CDATA #IMPLIEDandroid:layout_height CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:orientation CDATA #REQUIREDandroid:paddingBottom CDATA #IMPLIEDandroid:paddingLeft CDATA #IMPLIEDandroid:paddingRight CDATA #IMPLIEDandroid:paddingTop CDATA #IMPLIEDxmlns:android CDATA #IMPLIEDxmlns:tools CDATA #IMPLIED><!ELEMENT Spinner (#PCDATA)><!ATTLIST Spinnerandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:maxLines CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED><!ELEMENT EditText (#PCDATA)><!ATTLIST EditTextandroid:id CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:background CDATA #REQUIREDandroid:hint CDATA #REQUIREDandroid:maxLines CDATA #REQUIREDandroid:paddingBottom CDATA #REQUIREDandroid:paddingLeft CDATA #REQUIREDandroid:paddingRight CDATA #REQUIREDandroid:paddingTop CDATA #REQUIREDandroid:singleLine CDATA #REQUIREDandroid:textColor CDATA #REQUIREDandroid:textStyle CDATA #REQUIRED><!ELEMENT Button (#PCDATA)><!ATTLIST Buttonandroid:background CDATA #REQUIREDandroid:id CDATA #REQUIREDandroid:layout_gravity CDATA #REQUIREDandroid:layout_height CDATA #REQUIREDandroid:layout_marginTop CDATA #REQUIREDandroid:layout_width CDATA #REQUIREDandroid:text CDATA #REQUIREDandroid:textSize CDATA #REQUIRED>]>

相关问题