I have the latest visual studio 2019 (16.2.3
) Community Edition installed with Xamarin.
When I create a brand new solution with the Mobile App (Xamarin.Forms)
template and pick Android, I can't build it in any configuration.
It ends up with this output:
1>"C:\Users\myuser\source\repos\App3\App3\App3.Android\App3.Android.csproj" (Build;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) ->
1>(_UpdateAndroidResgen target) ->
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: resource style/Theme.AppCompat.Light.Dialog (aka com.companyname.app3:style/Theme.AppCompat.Light.Dialog) not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(4): error APT0000: style attribute 'attr/colorAccent (aka com.companyname.app3:attr/colorAccent)' not found.
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.companyname.app3:style/Theme.AppCompat.Light.DarkActionBar) not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/windowNoTitle (aka com.companyname.app3:attr/windowNoTitle)' not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/windowActionBar (aka com.companyname.app3:attr/windowActionBar)' not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/colorPrimary (aka com.companyname.app3:attr/colorPrimary)' not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/colorPrimaryDark (aka com.companyname.app3:attr/colorPrimaryDark)' not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(3): error APT0000: style attribute 'attr/colorAccent (aka com.companyname.app3:attr/colorAccent)' not found.
1> C:\Users\myuser\source\repos\App3\App3\App3.Android\Resources\values\styles.xml(4): error APT0000: style attribute 'attr/windowActionModeOverlay (aka com.companyname.app3:attr/windowActionModeOverlay)' not found.
1> C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: failed linking references.
Referenced packages in App3.Android.csproj are as follow:
<PackageReference Include="Xamarin.Forms" Version="4.1.0.555618" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" />
Minimum Android version is Android 5.0 (API Level 21 - Lollipop)
Target Android version is Android 9.0 (API Level 28 - Pie)
For whatever reason it can lock itself in this state.
Deleting *\bin
& *\obj
solves the issue.
Do this in order:
If deleting the bin
and obj
folders doesn't solve this for you, there is one more thing you can do.
You may have to run dotnet restore
in the project folder. Easiest way to do that is by selecting Tools -> Command Line -> Developer Command Prompt from the VS menu.
Reinstall all NuGet packages. Tools -> NuGet Package Manager -> Package Manager Console, then type Update-Package -Reinstall
and hit enter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With