当前位置: 首页 > 知识库问答 >
问题:

Android资源编译失败的原因?

傅英喆
2023-03-14

我试过很多方法,但都不奏效...

Android资源编译失败输出:C:\users\user\desktop\new Android\test1_tp7\app\src\main\res\layout\activity_main.xml:1:错误:格式不正确(无效令牌)。命令:c:\users\user.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\2aa1a50b275688b3c8017d916765ab19\aapt2-3.2.1-4818971-windows\AAPT2.exe compile-legacy\-o\c:\users\user\desktop\new android\test1_tp7\app\build\intermediates\res\merged\debug\c:\users\user\desktop\new android\test1_tp7\app\src\main\res\layout\activity_main.xml Daemon:AAPT2 aapt2-3.2.1-4 818971-Windows后台进程#2

<?xmlversion="1.0"encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabWidget android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <AnalogClock android:id="@+id/tab1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
        <Button android:id="@+id/tab2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Unboutonpresquealéatoire" />


 </FrameLayout>
</LinearLayout>
</TabHost>

另外,当我运行我的项目时,我突然看不到我的手机设备了。我已经尝试下载谷歌USB驱动程序,清理项目,重启缓存,但似乎没有任何工作

共有1个答案

岳永思
2023-03-14

xml声明中的?xml与版本、版本与编码之间缺少space。添加一个空格,它应该工作良好。

<?xml version="1.0" encoding="utf-8"?>
 类似资料:
  • 更新android工作室后…我的项目崩溃了,出现以下错误 我的项目级别是 和应用程序级别渐变 如果还需要更多的信息,请告诉我们。任何帮助都将不胜感激。更新后,它没有工作,也试图降级到3.1.0,但它没有工作,只是打开了价值。xml在建立- urn:oasis:names:TC:xliff:document:1.2显示URI未注册 “xmlns:ns2=”http://schemas.android

  • 我刚刚将我的android工作室更新到3.2.1版,并通过android工作室将我的gradle更新到最新版本,但构建项目面临此错误: Android资源编译失败输出:D:\project\myProject\app\build\mediates\增量\mergeDebugResources\merged.dir\值\values.xml:2577:错误:内部元素必须是资源引用或为空。D:\pro

  • 我正在Android Studio上开发一个应用程序,一切都很顺利,但是当我将Android Studio更新到最新的3.2.1时。每当我重建它时,它开始抛出错误,如: 值.xml 此值行中出现错误: 我尝试了一切可能的方式来修复值中的错误,但没有解决方案,每当我对值.xml文件进行更改时,默认文件都会在重建后再次出现。任何帮助将不胜感激 非常感谢您在这件事上花费的时间和帮助。

  • com.Android.builder.internal.aapt.v2.aapt2exception:Android资源编译失败/users/username/.gradle/caches/transforms-2/files-2.1/94 a628954aabd306de764f6ff2843371/res/values/values.xml:8:5-35:25:aapt:error:资源'a

  • 命令:/users/adham/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx/aapt2-3.2.1-4818971-osx/AAPT2 compile--o\/users/adham/deskto/android/todo/app/build/mediates/incremental/mergedebugresourc

  • Android Studio更新到3.2.1 Gradle版本后,获取Android资源编译失败:3.3.0在消息视图中获取以下错误 Android资源编译失败E:\AndroidProjects\OnlineMp3\app\build\intermediates\incremental\mergedebugresources\merged.dir\values\values.xml:595:错误