Android 构建错误不显示 R 内容

标签 android build

所以我只是将我的应用程序转移到另一台笔记本电脑上,当我尝试构建此错误提示时。请帮忙。我需要更改什么?

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  Output:  C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:651: error: <item> inner element must either be a resource reference or empty.
  C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:652: error: <item> inner element must either be a resource reference or empty.

  Command: C:\Users\Rhylle Vincent\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\f919f683d074912d6e0f1b8bf0931ab0\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
          -o \
          C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\res\merged\debug \
          C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\src\main\res\values\ids.xml:4:5-54: AAPT: error: <item> inner element must either be a resource reference or empty.

  C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\src\main\res\values\ids.xml:3:5-47: AAPT: error: <item> inner element must either be a resource reference or empty.

  Command: C:\Users\Rhylle Vincent\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\f919f683d074912d6e0f1b8bf0931ab0\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
          -o \
          C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\res\merged\debug \
          C:\Users\Rhylle Vincent\Desktop\01-03-2018-740pm\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s

ids.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="timebar" type="id">Time</item>
    <item name="textClock" type="id">textClock</item>
</resources>

最佳答案

应该是:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="timebar" type="id"/>
    <item name="textClock" type="id"/>
</resources>

引用号是 here .

关于Android 构建错误不显示 R 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53690016/

相关文章:

android - 无法找到 : ComponentInfo{. 的检测信息 ./android.support.test.runner.AndroidJUnitRunner}

android - 为什么 TextViews 在 RelativeLayout 中相互碰撞

javascript - react native : Tried to run my first app

node.js - 符号链接(symbolic link) SublimeText3 构建系统问题(Mac 到 PC)

java - 如何将特定字段用于特定的应用程序构建(调试/发行版)?

android - 是否有用于删除警报的 Android API

java - 如何计算包含一组元素的矩形

android - 根据高度调整ImageView宽度

visual-studio - 在VS Community 2017中的哪里找到Microsoft.TeamFoundation.Build.Workflow.dll

c# - 将构建版本号应用于程序集时出现 VSTS 问题