Xamarin-android: Failed linking references in Android project (Xamarin - Visual Studio Community 2019)

Created on 18 Oct 2019  路  16Comments  路  Source: xamarin/xamarin-android

Error       resource style/Theme.AppCompat.Light.DarkActionBar (aka com.companyname.xamapp:style/Theme.AppCompat.Light.DarkActionBar) not found.    XAMApp.Android          
Error       failed linking references.  XAMApp.Android          
Error       resource style/Theme.AppCompat.Light.Dialog (aka com.companyname.xamapp:style/Theme.AppCompat.Light.Dialog) not found.  XAMApp.Android          
Error       style attribute 'attr/windowNoTitle (aka com.companyname.xamapp:attr/windowNoTitle)' not found. XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorPrimary (aka com.companyname.xamapp:attr/colorPrimary)' not found.   XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/windowActionBar (aka com.companyname.xamapp:attr/windowActionBar)' not found. XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorPrimaryDark (aka com.companyname.xamapp:attr/colorPrimaryDark)' not found.   XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorAccent (aka com.companyname.xamapp:attr/colorAccent)' not found. XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 3   
Error       style attribute 'attr/windowActionModeOverlay (aka com.companyname.xamapp:attr/windowActionModeOverlay)' not found. XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 4   
Error       style attribute 'attr/colorAccent (aka com.companyname.xamapp:attr/colorAccent)' not found. XAMApp.Android  D:\VS2019Projects\XAMApp\XAMApp.Android\Resources\values\styles.xml 4   
App+Library Build

Most helpful comment

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

All 16 comments

Please attach a reproducible test case and a build log.

This is likely a NuGet restore issue. Restoring packages in your project may fix the problem.

Apologies if this problem has already been fixed, but I found that this happened to me immediately after updating my android SDK platform.
I found that (within visual studio) cutting everything within in styles.xml, letting it build, pasting it all back in, then rebuilding the project rather than the regular build process fixed it for me.

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

Deleting 'bin' and 'obj' not work with me

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

Deleting 'bin' and 'obj' not work with me

For me also not working.

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

Deleting 'bin' and 'obj' not work with me

For me also not working.

It is also not working for me. Cleaning and rebuilding the solution in VS also didn't work.

Update:

In my case the error was in one of my resources, the 'Styles.xml' was not properly formatted. After I fixed it it managed to build.

deleting bin and obj did nothing for me too. I tried a NuGet restore and it failed with something about a downgrade detected in my Android Support packages. Upgrading them fixes the issue. [Updating to VS2019 from 2017 had me add an explicit reference to Xamarin.Essentials in Android.csproj which I think is what then caused Android Support package version issues.] However I can get the error to go away by upgrading then downgrading the Support packages so no idea what is happening. Prob not useful to anyone but wanted to share my experience just in case.

Sorry, I only offered the suggested fix because it worked for me. Perhaps there's multiple issues occurring here and deleting the intermediates solves it in a specific case?

Screenshot 2020-02-07 at 19 29 26
Hello. I managed to solve this problem by updating the nugget packages. Version of which you can see in the screenshot.

I ran the following in Package Manager Console to fix my issue:
Install-Package Xamarin.Android.Support.v7.AppCompat

It appears the issue is fixed by restoring nuget packages as suggested by @jonpryor, therefore I'm closing the issue. @bharanidharan1707 if you still experience this and restoring nugets doesn't help, please reopen.

@grendello
Neither restoring the packages nor 'Install-Package Xamarin.Android.Support.v7.AppCompat' is working for me. Please find the attached screenshot of the errors. Any inputs will be highly appreciated
@xphacter @bondsy777 @thisdarktao @HelenMamalaki @olivierbouchomsfreshheads @bharanidharan1707 @thaihuydang @NickyAsher @jonpryor -

Severity Code Description Project File Line Suppression State
Error failed linking references. ScanbotBarcodeSDKFormsExample.Android
Error resource attr/flow_horizontalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_horizontalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 269
Error resource attr/flow_verticalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_verticalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 269
Error resource attr/flow_horizontalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_horizontalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 270
Error resource attr/flow_verticalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_verticalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 270
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 272
Error resource attr/flow_verticalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_verticalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 272
Error resource attr/flow_horizontalSeparator (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/flow_horizontalSeparator) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 272
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 275
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 276
Error resource attr/waveDecay (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/waveDecay) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 285
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 285
Error resource attr/motionPathRotate (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionPathRotate) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 289
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 291
Error resource attr/motionProgress (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/motionProgress) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 319
Error resource attr/duration (aka io.scanbot.example.sdk.barcode.xamarin.forms:attr/duration) not found. ScanbotBarcodeSDKFormsExample.Android C:\Users\user\Downloads\scanbot-barcode-scanner\scanbot-barcode-scanner-sdk-example-xamarin-master\Example.Forms\ScanbotBarcodeSDKFormsExample.Androidobj\Debug\90\lp34\jl\res\values\values.xml 336

image

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

Deleting 'bin' and 'obj' not work with me

For me also not working.

It is also not working for me. Cleaning and rebuilding the solution in VS also didn't work.

Update:

In my case the error was in one of my resources, the 'Styles.xml' was not properly formatted. After I fixed it it managed to build.

Could you please let me know what change you did in Styles.xml? Would appreciate any leads to this issue.

Upgrade XF version to resolve this problem

Consolidating the NuGet packages worked for me.

This same issue occurred for me after updating the Android SDK, however deleting bin and obj folders in the Android project solved the problem.

It Work, thanks!! (Y)

Was this page helpful?
0 / 5 - 0 ratings