fabulous-dev / Fabulous

Declarative UI framework for cross-platform mobile & desktop apps, using MVU and F# functional programming

Home Page:https://fabulous.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default template can not be built

LennardFi opened this issue · comments

I created a new project with the official template:

dotnet new -i Fabulous.XamarinForms.Templates
dotnet new fabulous-xf -n App

After running the lines above, I opened the project in VS and wanted to build it. The build process fails with the following error message. I haven't changed anything in the code yet. Did I forget something or why does it not compile? Is the template broken?

Build started...
1>------ Build started: Project: App, Configuration: Debug Any CPU ------
1>App -> C:\Users\[User-Dir]\prj\someDir\app-test\src\App\App\bin\Debug\netstandard2.1\App.dll
2>------ Build started: Project: App.Android, Configuration: Debug Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(157,3): error APT2260: resource style/Theme.AppCompat.Light.Dialog (aka com.company.App.Android:style/Theme.AppCompat.Light.Dialog) not found.
2>Resources\values\styles.xml(4,0): error APT2260: style attribute 'attr/colorAccent (aka com.company.App.Android:attr/colorAccent)' not found.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(157,3): error APT2260: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.company.App.Android:style/Theme.AppCompat.Light.DarkActionBar) not found.
2>Resources\values\styles.xml(2,0): error APT2260: style attribute 'attr/windowNoTitle (aka com.company.App.Android:attr/windowNoTitle)' not found.
2>Resources\values\styles.xml(2,0): error APT2260: style attribute 'attr/windowActionBar (aka com.company.App.Android:attr/windowActionBar)' not found.
2>Resources\values\styles.xml(2,0): error APT2260: style attribute 'attr/colorPrimary (aka com.company.App.Android:attr/colorPrimary)' not found.
2>Resources\values\styles.xml(2,0): error APT2260: style attribute 'attr/colorPrimaryDark (aka com.company.App.Android:attr/colorPrimaryDark)' not found.
2>Resources\values\styles.xml(3,0): error APT2260: style attribute 'attr/colorAccent (aka com.company.App.Android:attr/colorAccent)' not found.
2>Resources\values\styles.xml(4,0): error APT2260: style attribute 'attr/windowActionModeOverlay (aka com.company.App.Android:attr/windowActionModeOverlay)' not found.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(157,3): error APT2062: failed linking references.
2>Done building project "App.Android.fsproj" -- FAILED.
2>
2>Build FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Hi @LennardFi

It is a cryptic error that is unfortunately very common with Android. It's basically saying you have an issue with your Android SDK.

Make sure you follow the getting started documentation.

Also the templates target Android API level 30. Could you try installing this version and try again?

I uninstalled all existing Android devices in Device Manager, removed all installed Android-SDKs and installed a new one with Android R 11.0 (API version 30). Even after restarting Visual Studio and reinstalling the template, as well as recreating the project, the project cannot be built.

EDIT: I forgot to mention, that I followed the getting started doc: I'm using Visual Studio 22 with .NET 6.0.107, 6.0.203 and 6.0.302 installed. F# tools are installed too.

Sorry @TimLariviere , I overlooked to create the project with fabulous-xf-vswin instead of fabulous-xf. After recreating the project with fabulous-xf-vswin I got another error about missing resources. But another issue here helped me: Build the app again after this error. Then it works.

Maybe sombody could change the doc to present the little note about using fabulous-xf-vswin better. For example by adding a section header like Visual Studio and Windows. Later today I could create a PR for this. I think that fix could prevent issues like mine ^^