Extreme case of "Error retrieving parent for item" - android

My Xamarin Android project doesn't compile anymore, with a couple error messages saying
Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Widget.Design.TabLayout'
Other errors that were thrown previously were in the same style, but said
No resource found that matches the given name (at 'textColor' with value '#color/md_white_1000')
I am aware that this is a very common Xamarin bug that is normally fixed by cleaning and rebuilding or, in rare cases, by clearing all packages and package caches so that they are downloaded again. However, this did not fix my error. I also completely reinstalled Xamarin and Visual Studio, but the error persists. At this point, i don't really know what to do except completely reformat my Mac.
Are there any trouble shooting steps I missed? Is this a bug that is only present in some version so that I need to downgrade? Please help, as I haven't been able to compile my code now for two days.

The log is saying that the app could not find certain resources, like TabLayout and #color/md_white_1000.
Did you install the NuGet packages related to Android AppCompat libraries? In NuGet Package Manager, search for AppCompat libraries. For example:
https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat
Those are necessary to find AppCompat resources and themes.

I found the answer: Apparently the newest version of the Xamarin AppCompat Package is corrupt. I was able to compile again by manually copying the project from my colleague, who hadn't updated his packages (the packages are in our .gitignore). That solved the problem and also explains why clearing the package caches didn't work: Visual Studio simply re-downloaded the corrupt package.

Related

Program type already present: android.support.annotation.PluralsRes error in Xamarin.Android project

I created a Xamarin.Android project and after I set the configuration:
- Dex compiler: D8
- Code Shrinker: R8
- Linking: Sdk Assembleies Only
I am presented with this error:
Program type already present: android.support.annotation.PluralsRes
I also have the LinkerPleaseInclude file.
I have to say that I am in Debug configuration.
I solved this issue by clearing cache for Nuget Packages.
I know I'm a bit late but since the answer for this matter did not work for me, here is how I solved it:
First of all, it's obviously a NuGet packages problem, so I searched in my .nuget folder at C:\Users{yourUser}.nuget\packages and looked inside some of the folders, in my case the Android support libraries folders, and saw that there were folders for many versions of that library excetp for the one I was referencing in my project wich was 28.0.0.3, the last version at this moment, the newest I had in the folder was for 28.0.0.1 so instead un uninstalling and installing everything again I just modified the android.csproj, changed the referenced versions for the support libraries for 28.0.0.1 and then it gave another error, I just literally downgraded some other libraries to 28.0.0.1 from Visual Studio NuGet package manager and then everything worked fine.
Have a nice one. It took weeks for me of trying to find out.
Neither of the above solutions worked for me. I encountered the error opening an Xamarin project that was created in VS 2015 on VS 2019. I changed the "Compile using android version" in the manifest to Android 9.0, updated the NuGet packages, but this error remained. I also attempted the tried-and-true deleting ".vs", "bin" and "obj" folders.
What finally got rid of the "Program type already present: android.support.annotation.PluralsRes" error was deleting everything in the "Packages" folder for the project. My understanding is that directory was eliminated in VS 2017, but suppose because the original project was VS 2015 it was still being utilized and causing the conflict.
I was getting
Program type already present: androidx.appcompat.content.res.AppCompatResources$ColorStateListCacheEntry error.
I had 2 references
a)Xamarin.AndroidX.Appcompat and
b)Xmarin.Androidx.appcompat.content.res.AppCompatResources
I removed the reference Xmarin.Androidx.appcompat.content.res.AppCompatResources
And now the project builds without errors

Eclipse Android No resource error

I have started learning android development using the eclipse IDE. I am using the book "Android application programming" by James Talbot & Justin McLean.
I have downloaded Eclipse and the Android SDK. However, when I create a new android project I get the error:
[2018-04-16 23:53:15 - OnYourBike-Chapter3] C:\Users\benjo\workspace\learningandroid\OnYourBike-Chapter3\res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
[2018-04-16 23:53:15 - OnYourBike-Chapter3]
and another one but for Theme.AppCompat.Light.
I am very new to both eclipse and android SDK and the solutions I have read were mostly to go to "android-sdk\extras\android\support\v4 or v7 and import a library. I don't have these v4 or v7 folders. I have a bunch of folders like this:
Folder contents
I have tried adding the .jar libraries from these folders, but it didn't work.
I have tried cleaning, building the project, replacing the code in the style.xml file, installing the Android Support Repository (tried installing Android Support Library, but couldn't find it).
I have gone through atleast 10 threads just on stackoverflow and couldn't fix my issue. Nothing worked.
My mainActivity.java file is full of errors, and looks like this:
mainActivity
The error on the import reads: "The import android.support cannot be resolved".
Here are pictures of my Android SDK Manager :
Android SDK Manager SDK Tools
Android SDK Manager Extras
Hopefully someone can help me solve this. It is really frustrating and I have spent my whole day trying to fix this with no success.

Compiling and using AppCompatActivity in Eclipse

I have the latest Android Support Library, Android Support Repository and Google Repository (Rev. 23.1, 24, 22 respectively) and working with Eclipse Mars.1(4.5.1)
In the process of giving a make-over to an existing app, I am trying to import the v7.AppCompatActivity library, closing all other projects in workspace and silent prayers. ( ;-) )
Observations:
I daresay I have been unsuccessful even after following the instructions here to the dot.
Ian Lake's blog looks all hunky-dory, but Utopian.
Reading up tons of excellent answers on SO did not yet help. No matter what target is set in the project.properties page or what Build Target is set in the Eclipse Project Properties dialog - just cannot seem to get rid of this (and very similar) compile error(s):
android-support-v7-appcompat\res\values-v23\styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Going by the number of similar questions, I am surely not alone. Pray, can someone kindly throw some light on how to import the v7 support library without going insane?
Thanks in advance!
None of the answers or blogs pointed out the following, except #pkuszewski.
The above issue resolves on
upgrading to Android 6 Marshmallow API 6.0 with the SDK manager
setting the Build Target for the AppCompat project to Android 6.0
Did I hear, "Duh"? :)
Thanks, #pkuszewski!
SDK Manager fragment looks like this, post the fix:

Resource entry com.crashlytics.android.build_id is already defined - Android Studio

Out of nowhere my Android Studio project started giving me this error: Resource entry com.crashlytics.android.build_id is already defined. I've seen a similar question to mine here on SO, but the solution is not working for me. Every time I try to delete the duplicate entry, it just keeps regenerating on a project rebuild. I could really use any suggestions at this point. Thanks in advance!
Here is the whole error:
C:\Users\Alex\Documents\AppDevelopment\workspace\AsylumLakePreserve\build\intermediates\exploded-aar\workspace\google-play-services_lib\unspecified\res\values\values.xml
Error:(1) Resource entry com.crashlytics.android.build_id is already defined.
C:\Users\Alex\Documents\AppDevelopment\workspace\AsylumLakePreserve\build\intermediates\res\debug\values\com_crashlytics_build_id.xml
Error:(9, 1) Originally defined here.
As pointed out by #yehan in his comment below, these days the issue is most likely causes by not removing fabric decencies/data when upgrading to fire base.
Original:
You've probably already worked around this looking at how old the question is and looking at the error I'm not sure you've got the same issue... but for anyone else stumbling on this one I also ran into something similar whilst updating an old code base from Crashlytics to Fabric and speaking to the Fabric support team they stated that deleting the com_crashlytics_export_strings.xml that was under my app/src/.. directory folder was the correct solution.

R cannot be resolved to a variable - cleaning doesn't work

I've recently deleted some other projects from my eclipse workspace (permamently) and after that in my current project appeared some errors (R cannot be resolved to a variable).
I tired cleaning and building again project, but this time it doesn't help.
In resources, errors appears only in styles.xml files:
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
I'm new in android development and I don't understand what's exactly wrong. Probably something with theme, but I tried to change it to something different - without effects.
Download the v7-appcompat library, import it into Eclipse and reference it in those projects which are showing this error. This will solve your problem.

Categories

Resources