Skip to content

AvaloniaSplashActivity not available #417

Closed
@Ecsodikas

Description

@Ecsodikas

Hi everyone,

I was playing around with FuncUI and I am really happy with it. The problem I encountered was when I tried to deploy my app for Android. I pretty much copy & pasted the templates and my problem is in this file SplashActivity.fs. For some reason there is no AvaloniaSplashActivity.

error FS0039: The type 'AvaloniaSplashActivity' is not defined. Maybe you want one of the following:   AvaloniaMainActivity [/home/ecsodikas/Repositories/Nachruf/Nachruf.Android/Nachruf.Android.fsproj]

It runs flawlessly on the desktop build.

The complete file looks like this:

namespace Nachruf.Android

open Android.App
open Android.Content
open Android.Net
open Avalonia.Android
open Avalonia.Android;


type Application = Android.App.Application

[<Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)>]
type SplashActivity() =
    inherit AvaloniaSplashActivity<Nachruf.App>()

    override this.CustomizeAppBuilder builder =
        Nachruf.About.urlOpen <-
            fun url ->
                this.StartActivity(
                    (new Intent(Intent.ActionView, Uri.Parse url))
                        .SetFlags(ActivityFlags.ClearTop ||| ActivityFlags.NewTask)
                )

        base.CustomizeAppBuilder builder

    override this.OnResume() =
        base.OnResume()
        this.StartActivity(new Intent(Application.Context, typeof<MainActivity>))

and the fsproj file looks like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0-android</TargetFramework>
    <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
    <Nullable>enable</Nullable>
    <ApplicationId>eu.ecsodikas.Nachruf</ApplicationId>
    <ApplicationVersion>1</ApplicationVersion>
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <AndroidPackageFormat>apk</AndroidPackageFormat>
    <AndroidSdkDirectory>/home/ecsodikas/.android/sdk</AndroidSdkDirectory>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'=='Release'">
      <PublishTrimmed>True</PublishTrimmed>
      <RunAOTCompilation>True</RunAOTCompilation>
      <AndroidEnableProfiledAot>True</AndroidEnableProfiledAot>
      <!-- https://github.com/dotnet/runtime/issues/79910 -->
      <EnableLLVM>False</EnableLLVM>
      <AndroidLinkTool>r8</AndroidLinkTool>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.1.3" />
      <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel" Version="2.3.1.3" />
      <PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
      <ProjectReference Include="..\Nachruf\Nachruf.fsproj" />

      <None Include="Properties\AndroidManifest.xml" />
      <AndroidResource Include="Icon.png">
        <Link>Resources\drawable\Icon.png</Link>
      </AndroidResource>
      <AndroidResource Include="Resources\**\*" />
      <Compile Include="MainActivity.fs" />
      <Compile Include="SplashActivity.fs" />
    </ItemGroup>

</Project>

Is there some documentation where the AvaloniaSplashActivity has gone or what replaced it? Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions