dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.92k stars 526 forks source link

Getting a "failed linking references" error when running an Android Project (Xamarin - Visual Studio 2022) #8902

Open BantiPlayz opened 4 months ago

BantiPlayz commented 4 months ago

Android application type

Classic Xamarin.Android (MonoAndroid13.0, etc.)

Affected platform version

VS 2022

Description

I simply wanna test out this application: (https://github.com/bojibenji/Language-Learning-App-EZJapanese) on the android emulator but I keep getting several errors when doing so. I am new to Xamarin and C# Application development, but I just wanna experience running this specifically. So can anyone please show me the steps on how I can run this android application?

Steps to Reproduce

Solutions Attempted: Updating NuGet Packages, rebuilding solution, then I get error: "The $(TargetFrameworkVersion) for EasyJ.Android (v9.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (10.0). You need to increase the $(TargetFrameworkVersion) for EasyJ.Android. ", I increased the TargetFrameworkVersion to 10.0, rebuild solution, back to the "failed linking references" and ocean of errors.

Did you find any workaround?

No response

Relevant log output

Severity    Code    Description Project File    Line    Suppression State
Error       resource style/Theme.AppCompat.Light.DarkActionBar (aka com.companyname.EasyJ:style/Theme.AppCompat.Light.DarkActionBar) not found. EasyJ.Android           
Error       failed linking references.  EasyJ.Android           
Error       resource style/Theme.AppCompat.Light.Dialog (aka com.companyname.EasyJ:style/Theme.AppCompat.Light.Dialog) not found.   EasyJ.Android           
Error       style attribute 'attr/windowNoTitle (aka com.companyname.EasyJ:attr/windowNoTitle)' not found.  EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorPrimary (aka com.companyname.EasyJ:attr/colorPrimary)' not found.    EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorPrimaryDark (aka com.companyname.EasyJ:attr/colorPrimaryDark)' not found.    EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/windowActionBar (aka com.companyname.EasyJ:attr/windowActionBar)' not found.  EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 2   
Error       style attribute 'attr/colorAccent (aka com.companyname.EasyJ:attr/colorAccent)' not found.  EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 3   
Error       style attribute 'attr/windowActionModeOverlay (aka com.companyname.EasyJ:attr/windowActionModeOverlay)' not found.  EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 4   
Error       style attribute 'attr/colorAccent (aka com.companyname.EasyJ:attr/colorAccent)' not found.  EasyJ.Android   D:\Storage\User\VisualStudio\Projects\Language-Learning-App-EZJapanese-master\EasyJ\EasyJ\EasyJ.Android\Resources\values\styles.xml 4
dellis1972 commented 4 months ago

I don't have the old Classic Xamarin.Android installed anymore (it goes out of support soon) so its difficult to test. My guess is that the NuGet packages will need upgrading if you want to up the TargetFramework to 10.0.

BantiPlayz commented 4 months ago

@dellis1972 I said I updated the NuGet packages though

dellis1972 commented 4 months ago

So its likely then that those resouces have moved to another package as part of the update. I'm not sure which one though.

bulubuloa commented 3 months ago

hi @BantiPlayz Did you have a solution for this

yablos commented 3 months ago

This one helped:

"Make sure you have TargetFrameworkVersion=v13.0 in your Droid.csproj" Previously, there was = v10 And that was all + all your mentioned(delete bin,obj, nuget...)

More possible hotfixes: https://stackoverflow.com/questions/77539174/xamarin-forms-5-0-0-2622-compilation-error-about-styles-xml