I Replaced one attribute of all of my .xml files by a mistake. so I undo all of them . now Android failed to compile the project because of internal files that does not belong to my project . look at this Error for example:
Android resource compilation failed
Output: C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\support-
compat-28.0.0.aar\0f40d142e6b58b7fe15914d4ec5e3dc5\res\layout\notification_action.xml:24: error: duplicate attribute.
Command: C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\cacb99a92dc25d61ade7acbb3a469d02\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\andrew\AndroidStudioProjects\clone\app\build\intermediates\res\merged\debug \
C:\Users\andrew\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0.aar\0f40d142e6b58b7fe15914d4ec5e3dc5\res\layout\notification_action.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #3
this happened for many .xml in internal files .
my IDE is Android Studio 3.2.1
This happened to me .Delete this file C:\Users\andrew.gradle\caches\transforms-1 form windows and build your project. this should solve your problem .
Related
I get this error "Error: Content is not allowed in prolog" in colors.xml everytime when I create a new project in Android Studio.
My auto generated colors.xml :
/* AUTO-GENERATED FILE. DO NOT MODIFY.** This class was automatically
generated by the* gradle plugin from the resource data it found. It* should not
be modified by hand.*/package android.ar
When I resolve this error by manually writing the correct code in colors.xml, this error comes :
Android resource compilation failed
Output: C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml:1: error: not well-formed (invalid token).
Command: C:\Users\Lenovo\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\3fe9903feff1f1df45dbb24febdc7fc3\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\build\intermediates\res\merged\debug \
C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\src\main\res\mipmap-anydpi-v26\ic_launcher_round.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
anydpi-v26\ic_launcher_round.xml :
/* AUTO-GENERATED FILE. DO NOT MODIFY.** This class was automatically generated by the* gradle plugin from the resource data it found. It* should not be modified by hand.*/package android.support.localbroadcastmanager;
public final class R {pr
After resloving this , this error comes :
Android resource compilation failed
Output: C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\src\main\res\mipmap-anydpi-v26\ic_launcher.xml:1: error: not well-formed (invalid token).
Command: C:\Users\Lenovo\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\3fe9903feff1f1df45dbb24febdc7fc3\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\build\intermediates\res\merged\debug \
C:\Users\Lenovo\AndroidStudioProjects\WhatstheWhether\app\src\main\res\mipmap-anydpi-v26\ic_launcher.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
After resolving this error, same error comes in ic_launcher_foreground.xml and ic_launcher_background.xml . After resolving all these errors when I run my project , another error comes - Error running 'app': Default Activity not found . So after editing configurations , my app runs fine but I have to follow this whole procedure in every new project. Please help.
Below this, is my issue in my App when try to built it. I've tried lots of things but was unable to solve it.
Android resource compilation failed
Output: D:\ashish android\DreamTouchIndia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2582: error: duplicate value for resource 'attr/theme' with config ''.
D:\ashish android\DreamTouchIndia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2582: error: resource previously defined here.
Command:
C:\Users\hp\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\3b90f5710266fb9a4db1b900d48eb915\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
D:\ashish android\DreamTouchIndia\app\build\intermediates\res\merged\debug \
D:\ashish android\DreamTouchIndia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2
check your module gradle . you may define dependency twice
Android resource compilation failed
Output: H:\OzelDersim\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1019: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''.
H:\OzelDersim\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1019: error: resource previously defined here.
Command: C:\Users\Emre Hmrc\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\0d3beb61e3dde971f53232b7b0aae803\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
H:\OzelDersim\app\build\intermediates\res\merged\debug \
H:\OzelDersim\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
In the module build.gradle (app), add support:design in dependencies:
implementation 'com.android.support:design:28.0.0'
Replace the version with the one used in your module and don't forget to Sync.
To check the latest version or for more information.
In your module build.gradle file check for a line
implementation 'com.android.support:support-v4:27.1.1'
remove it and rebuild.
I encountered the same error today after adding the default "SettingsActivity" files. The wizard inserted this line in the build.gradle file, causing the error.
Hint: use a version control system, it helps to discover such subtle errors easily.
its showing on build console:
Android resource compilation failed
Output: C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1434: error: inner element must either be a resource reference or empty.
Command: C:\Users\User.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\fc444429c9ac9f1db8d9bb3790bf9413\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\res\merged\debug \
C:\Users\User\AndroidStudioProjects\Booklify\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2
Please write this command on terminal of your project in android studio.
gradlew clean
I recently had a similar issue. Please have a look into your values.xml at the given line. There will most likely be some id like
<item name="abc" type="id"/> which has not /> but a value like <item name="abc" type="id">abc</item>
This wasn't allowed since the beginning but now it also causes a compilation error. So remove the value and the closing tag and add the slash before the >
Edit: Of course you need to do this change in the ids.xml (or any other related file) not in the values.xml inside the build folder. But this file gives you the hint where to look.
After upgrading Android Studio to the latest version, it keeps on giving me this error and I can't run my code at all!!
Here's the error
Android resource compilation failed
Output: C:\Users\Khairy\Desktop\Patient App\android-patient-app\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1072: error: duplicate value for resource 'attr/style' with config ''.
C:\Users\Khairy\Desktop\Patient App\android-patient-app\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1072: error: resource previously defined here.
Command: C:\Users\Khairy\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\dd46b604dd8462c5ee8864f277da747e\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Khairy\Desktop\Patient App\android-patient-app\app\build\intermediates\res\merged\debug \
C:\Users\Khairy\Desktop\Patient App\android-patient-app\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
error: duplicate value for resource 'attr/style' with config ''
Check values.xml or styles.xml to see if there is any duplicate entries-strings. (called attr/style maybe)
You can also try removing intermediates or build directory then doing clean-rebuild project and then it should work as expected.