Android preference defautvalue duplicate resource - android

I want to make a settings activity for an android app. I used the standard activity for the settings but I keep getting the error:
\.gradle\caches\transforms-2\files-2.1\e3ce7e7cf0568bf54350349961cc10db\preference-1.1.1\res\values\values.xml:257:5-336:25: AAPT: error: duplicate value for resource 'attr/defaultValue' with config ''.
I think it has something to do with the androidx.preference.PreferenceFragmentCompat because the error disappears when I remove the dependency on android.preference:preference:1.1.1. Do you know how to fix this?

I figured it out. The DevaultValue was already defined by me in the res/attr/ folder. deleting this value makes it work.

If you already have a field with defaultValue in attrs file, rename it and try rebuild it. It works

Related

"AAPT: error: resource not found" when I'm testing

I've written an instrumented test. When I run it I get an error:
/Users/ilamasin/StudioProjects/ecwid/general/build/intermediates/packaged_res/debug/drawable/horizontal_divider_with_padding.xml:6:
AAPT: error: resource dimen/horizontal_divider_thickness (aka
com.ecwid.android.reports.test:dimen/horizontal_divider_thickness) not
found.
It's my drawable in project and it exists. My project runs and works. But test doesn't. Did anyone has this error? I use Junit and Mockito (Sorry for my English)
just go to dimen file and add value to this-:
res->values->dimen and give value to dimen/horizontal_divider_thickness
or go to drawable file and pass value i.e 15dp or 20dp whatever you want to add.

Duplicate value for resource 'attr/pivotX' with config ' '

After a month, launched Android studio and on syncing with Gradle, this error pops up. Rebuilding/cleaning the project does not works and shows the same error again.
I have tried to rebuilding/clean and invalidate/restart the project but nothing seems to be working. I have searched out on this site about the problem but yet again nothing seems to be working. Would be really great if someone helps me with this one because I am stuck and can`t provide update my app.
Android resource compilation failed
Output: E:\Play Store Listings\Notepedia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2616: error: duplicate value for resource 'attr/pivotX' with config ''.
E:\Play Store Listings\Notepedia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2616: error: resource previously defined here.
E:\Play Store
Listings\Notepedia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2616: error: duplicate value for resource 'attr/pivotY' with config ''.
E:\Play Store Listings\Notepedia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2616: error: resource previously defined here.
Command: C:\Users\Taseer.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\8dd90688e4f5a22b34a1a148f45c2455\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
E:\Play Store Listings\Notepedia\app\build\intermediates\res\merged\debug \
E:\Play Store Listings\Notepedia\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
EDIT: This is where the error leads to: Image
EDIT 2: Link to download(File removed)
In my case I tried to implement new versiont of Constraint Layout(in gradle)
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
and I get this error. I dont want to edit any attribes, I do revert to stable version
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
And the error dessapears.
That helped me.
Find library that cause that conflict (just remove libraries dependencies one by one and sync gradle).
Go to External Libraries > "conflict library" > res > values
Open values.xml and find there an attribute with the conflict name (in that case it's 'pivotX') and refactor that name to any other.
I had this same issue and had to look through the beta changes. Found the problem has been fixed in beta8
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
For future reference, I am posting the comment as anwer
pivot is already defined as view attribute. that might be the reason you are having this issue. try prefixing some label may be like transformPivotX and this might work. Do this for all the attribute you have in image shared.

How do I fix Error: Duplicate id in Android Studio

I getting
Error:(7) Error: Duplicate id #+id/item, already defined earlier in
this layout [DuplicateIds]'
I'm using Android Studio. How can I fix it? Thanks in advance.
If you using text layout and check the xml code for finding the red line(indication of error) in android studio.
If you have than change the value like shown in the image and finally clean and build the project.
Error Image
After change the id
Maybe you had defined two view with the same id.Check your code.(ctrl+f)
It is not the as's fault.

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

Trying to run a project in eclipse ADT, but keep on getting a huge list of xml errors

I imported an Android project into my eclipse workspace, but I get getting the following errors. I have googled for a resolution but have not found one. Please can anyone point me in the right direction? Thank you in advance!
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:5: error: Attribute "mapType" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:12: error: Attribute "cameraBearing" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:13: error: Attribute "cameraTargetLat" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:14: error: Attribute "cameraTargetLng" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:15: error: Attribute "cameraTilt" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:16: error: Attribute "cameraZoom" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:17: error: Attribute "uiCompass" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:18: error: Attribute "uiRotateGestures" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:19: error: Attribute "uiScrollGestures" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:20: error: Attribute "uiTiltGestures" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:21: error: Attribute "uiZoomControls" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:22: error: Attribute "uiZoomGestures" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:23: error: Attribute "useViewLifecycle" has already been defined
C:\Development\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\maps_attrs.xml:24: error: Attribute "zOrderOnTop" has already been defined
EDIT
This is my Android project properties:
You are importing the google-playservices` library twice - and two different versions (one is labeled "froyo" on your screen shot).
Probably delete the old one and it will be fine. But the issue is that you cannot have resources defined twice and differently. Sometimes you can have the some one twice and defined the same and sometimes the build will not detect duplicates in Eclipse.
Get rid of one of the two editions of google-play-services that you have in your project libraries list.

Categories

Resources