error : duplicate value for attr/style with config ' ' - android

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.

Related

Error: Content is not allowed in prolog - colors.xml

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.

Android resource compilation failed 3

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

duplicate value for resource 'attr/layout_anchorGravity' with config ''

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.

Can't compile files that don't belong to my project

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 .

Android Hello World Project Error: "Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #2"

2018/09/27
I upgraded android studio to 3.2.0 and created the default project.
But the compiler shows the error:
Android resource compilation failed
Output: C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\src\main\res\drawable\ic_launcher_background.xml:1: error: not well-formed (invalid token).
Command: C:\Users\DELL-BODETY\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\1135036532c8b3c53c96f89a2a22aaca\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\build\intermediates\res\merged\debug \
C:\Users\DELL-BODETY\AndroidStudioProjects\MyApplication3\app\src\main\res\drawable\ic_launcher_background.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #1
And I can't think of any way out.Just for help!!
app\src\main\res\drawable\ic_launcher_background.xml:1: error: not
well-formed (invalid token).
Go to drawable directory and find this file: ic_launcher_background.xml.
It seems like there is a compilation error, spelling mistake, not well typed or etc. You need to check which one is. It should show an error or something with red line error. Probably, used semicolon or something similar.

Categories

Resources