1

So I just transferred my app to another laptop and when I tried to build this error prompted. please help. What do I need to change?

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>
11
  • something wrong in your values.xml please share that file Commented Dec 9, 2018 at 6:41
  • i have no values.xml sir, where can I look for it? Commented Dec 9, 2018 at 6:44
  • @Kristopher - Do you have any resource files? If so, you might have an error due to the resource body tag not being empty. Check this solution. Commented Dec 9, 2018 at 6:48
  • please post \app\src\main\res\values\ids.xml Commented Dec 9, 2018 at 6:49
  • Hey did you updated your android studio ? Commented Dec 9, 2018 at 6:50

2 Answers 2

1

Should be:

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

the ref is here.

Sign up to request clarification or add additional context in comments.

Comments

1

On your Resource File remove the closing tag plus the Body i.e Remove "tv_deviceName"

  <item type="id" name="button_ok">tv_deviceName</item>

Id should be like this as below

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

Then, this layout snippet uses the "button_ok" ID for a Button widget:

<Button android:id="@id/button_ok"
    .... />

Notice that the android:id value does not include the plus sign in the ID reference, because the ID already exists, as defined in the ids.xml example above. (When you specify an ID to an XML resource using the plus sign—in the format android:id="@+id/name"—it means that the "name" ID does not exist and should be created.)

As another example, the following code snippet uses the "dialog_exit" ID as a unique identifier for a dialog:

showDialog(R.id.dialog_exit);

Refrence: Click here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.