Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android/iOS stability and scalability? #1602

Closed
danwalmsley opened this issue May 20, 2018 · 36 comments
Closed

Android/iOS stability and scalability? #1602

danwalmsley opened this issue May 20, 2018 · 36 comments
Labels

Comments

@danwalmsley
Copy link
Member

Issue moved from: VitalElement/AvalonStudio#651

@danwalmsley
Copy link
Member Author

@angelsix said:
I have some open source projects I will be making Android/iOS apps on shortly, and I hate Xamarin, used it for many years now and its awful and full of bugs and has been all along.
I do training videos and have quite a following now, and even though I will teach Xamarin as people want those lessons, I know how awful Xamarin is and would like to find a better cross platform solution.
I've in fact been looking at making my own full cross-platform UI for Win/Linux/Mac/iOS as could not find any and then one of the guys who watches my videos pointed me to this project. It looks very promising.
My question is more about the performance and scale-ability of this framework. For example what do you compile down to for Android/iOS and how are you doing the lists, virtualization, rendering etc... Is it something simple like a web browser hosted inside the app or is it compiled to native storyboards/layout files like you would build natively for the platforms?
Also what support do you have for all the mobile specific features like background modes, notifications, sharing intents, lifecycle events and so on?

@danwalmsley
Copy link
Member Author

danwalmsley commented May 20, 2018

@angelsix

Avalonia is just reaching a point where a few commercial projects are starting to adopt. We are now at a stage where we are in Beta and there are a few bugs, but on the whole the UI framework is stable and useable for all kinds of projects on the Desktop.

@kekekeks can provide more information regarding IOS / Android, although I believe these compile to .NET assemblies, with some .net runtime stuff need to make it run.

The rendering is native rendering, we use Direct2D /Skia on Windows, on Linux with use Skia, on Mac we use MonoMac (I think) we use GTK for window management on those platforms too.

Avalonia provides real applications (not a web browser pretending to be an app).

Avalonia is most closely related to WPF, then UWP, it uses lookless templated controls, so its a truly cross platform UI. You can achieve the exact same UI on all platforms, obviously you can customize UI to a specific platform too.

We don't use native controls, although some work has been done to allow embedding native controls on some platforms.

Regarding Mobile specific features, you can just use our UI with the Xamarin libraries or the native platform libraries directly for this kind of stuff.

Our mobile 'backends' as we call them are a little behind the Desktop, as we have fewer people contributing in that area, and are kind of considered experimental / alpha, whereas desktop apps are pretty much stable now.

It wouldn't take much to get the mobile backends up to scratch though, we mainly just need to add proper touch integration (we currently only have mouse pointers in the framework).

We would love to hear your feedback and it would be awesome to see a tutorial video on Avalonia from you at some stage if you wanted I could help get you started.

BTW I really like your WPF tutorial videos they are really high quality, I will start sending people there that come here with MVVM getting started type questions :)

@angelsix
Copy link

Cool thanks for the feedback. It sounds promising and perhaps something to finally bring not just desktop but mobile into one unified place. It has huge potential if done right and it was something I was going to make it nobody else did within the next year (I was holding out for MS to do it, and purchasing Xamarin was the first step in that direction). However, I see you have been working on this for a while now and it looks very nice and a lot of advanced and user-friendly features.

I will likely look at this in my spare time to get comfortable and a feel for it and if it seems good probably make a real simple application that will run on all 5 platforms and then if that works do videos on it. Pretty exciting stuff, keep up the good work

@EndlessDelirium
Copy link

We tried out the ControlCatalog on both Android and iOS. Apart from making a quick fix for #2228 we also had to add ReactiveUI to the startup projects and change the target version to 8.0 in the android project. Afterwards the app successfully launched on both mobile targets. There are multiple issues tough:

  • Performance isn't quite there yet. Launching the app on Android takes donkey's years and it doesn't recover after rotation (or I wasn't patient enough to wait for this to finally happen).
  • Basic rendering of the controls and simple touch events generally work, although on Android the pixel density is not taken into account.
  • Whatever requires an overlay is broken. ComboBoxes, Menus etc. just don't open.
  • Text input doesn't work. The keyboard doesn't appear.

Things aren't yet as smooth as on the desktop platforms and there still seems to be quite a bit of work left to get there. I really like the concept of Avalonia but think that it is crucial for its success that the mobile targets aren't treated like second class citizens. Question likely is whether there are other parties that are interested in helping pushing the mobile targets forward.

image

image

@kekekeks
Copy link
Member

For running properly on mobile platforms we still require the following:

General infrastructure:

  • Touch event support (I've got a laptop with touchscreen, to things will speed up a little)
  • Touch selection controls in TextBox
  • Input method support. Right now we are just handling whatever events are sent by keyboard. There is a lot of things to consider there, but at least we need controls to somehow announce that they expect text input.
  • XAML compilation to IL. It's fine to parse XAML at runtime on Desktop/iOS, since either device is powerful enough or parser is compiled using LLVM and is a bit faster.

Missing bits in mobile backends:

  • Enable GPU acceleration. We currently have a generic infrastructure for enabling OpenGL(ES) rendering that we are utilizing on desktop platforms, so it should be relatively easy to wire it up on mobile.
  • Add support for overlays for iOS (yes, they aren't implemented at all)
  • Fix overlays for Android (they were working before, no idea what's happened)

Not sure what happened to keyboard, but we were using some hacks for detecting if currently focused control is a TextBox.

@EndlessDelirium
Copy link

@kekekeks: are there any ballpark estimates what it would take to get first class mobile support?

@kekekeks
Copy link
Member

kekekeks commented Jan 11, 2019

I would say 2020 Q2 with our current scarce resources. The problem is that mobile support isn't currently actively worked on by anyone. I've made an updated roadmap which contains some features needed for mobile planned for 0.8 release (namely touch support and IM) that I'm planning to work on this year.

We could circumvent the need of IM support by reusing our old hack (iOS, Android), not sure why it doesn't work anymore.
XAML compilation is nice to have but not exactly required.

But that's probably it. Help with mobile backends would be very appreciated.

@EndlessDelirium
Copy link

Unfortunately this is a bit of a hen-egg problem. A possible involvement from our side would require other backers that are committed to help considerably speed up things and ensure long term maintenance.

@kekekeks
Copy link
Member

kekekeks commented Jan 11, 2019

I'll take a shot at mobile backend re-animation after getting touch support this spring, since I'll need to update them to make sure I'm not missing anything touch-input related. The set of new features probably would be popup support for iOS and GPU acceleration.

@DenisLanks
Copy link

Hi guys, good job. How can I contribute to this project?

@danwalmsley
Copy link
Member Author

best to get in touch via https://gitter.im/AvaloniaUI/Avalonia to see how best you can contribute :) welcome

@lorean-devries
Copy link

I want to suggest Avalonia to my company for a fully cross platform app, but I'm unsure if Android/iOS support has been fixed ?

@kekekeks
Copy link
Member

There were several things in the core framework that needed to be done before further attempts to get mobile platforms working:

  • Touch event support (done)
  • XAML-to-IL compilation (done)
  • in-window overlays so we don't need to bother with platform-specific ones for popups (done)
  • touch text selection in TextBox
  • IME support (needed for text input services like autocomplete, autocorrect, proper virtual keyboard type selection, etc)

Until at least those are ready it's kinda pointless to "fix" the mobile platform support, since we won't be able to deliver a proper UX anyway. There are also ongoing work on performance optimizations which are kinda required for low-power devices.

There is a chance of getting it till the end of the year, but I can't promise that right now.

@lastlink
Copy link

lastlink commented Feb 9, 2020

I wonder if some of the drawing can be pulled over from the dart flutter project since it also uses skia for it's gui engine.

@ILAgent
Copy link

ILAgent commented Mar 5, 2020

It would be great if you concentrated on mobile because the world is mobile-first today. Everybody wants to make a mobile app, not desktop.
I don't like Flutter due to awful Dart but now is the best solution unfortunately.

@MappingSteve
Copy link

MappingSteve commented Sep 9, 2020

@lastlink - it sounds like drawing is not an issue.

@kekekeks - when .Net 5 releases, will that cover your issues with running on iOS and Android?

My brief reading of .NET 5 is that it includes the essential mobile parts of Xamarin: doing that well from C# is what made Xamarin valuable. In my experience, Xamarin as ".Net Core on mobile platforms" works very smoothly - if you write the UI using Xamarin's "native" bindings for each platform's UI. (The cross-platform UI - Xamarin Forms - is the part that needs to be replaced by Avalonia.)

My point being that your project should -soon- not have to write much Android and iOS specific code, if Microsoft has done their job fully.

@Shayan-To
Copy link

@kekekeks Will you give us an update on how things are going?

@kekekeks
Copy link
Member

iOS: mostly working: some initialization issue that causes black screen until screen rotation, works completely fine in simulator, will probably ship a fixed version with 0.10.1 or something
Android: no progress so far

@ili
Copy link
Contributor

ili commented Jan 28, 2021

Android: no progress so far

Any plans/dates? :)

@kekekeks
Copy link
Member

#5328
#5331
#5337

@danwalmsley
Copy link
Member Author

@ili quite a lot of progess. its probably ready for people to start beta testing... expecting a few rough edges to help find what still needs doing.

@ili
Copy link
Contributor

ili commented Jan 29, 2021

@danwalmsley sounds really cool! I'll look forward to start porting my project to Avalonia!

@FloridaMatt
Copy link

I'd appreciate a clue or two about what I'm doing wrong here. I'm on a Mac running Big Sur 11.1. I need to figure out how to set up an Avalonia IOS project to I can recreate an ios app I created with Windows & Xamarin. I downloaded the Avalonia-Master, went to Samples/ControlCatalog.IOS, and double-clicked on the .sln file to start Visual Studio. Got the following:

Getting restore information for project /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj
/Users/t/.nuget/packages/msbuild.sdk.extras/2.0.54/Sdk/Sdk.props(25,3) : warning MSB4011: "/usr/local/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.props" cannot be imported again. It was already imported at "/usr/local/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.props (147,3)". This is most likely a build authoring error. This subsequent import will be ignored. [/Users/t/Downloads/Avalonia-master/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj]
/usr/local/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5) : warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy.
/usr/local/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.EolTargetFrameworks.targets(28,5) : warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy.
Running non-parallel restore.
Reading project file /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj.
The restore inputs for 'ControlCatalogiOS' have changed. Continuing restore.
Restoring packages for /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj...
Restoring packages for Xamarin.iOS,Version=v1.0...
Resolving conflicts for Xamarin.iOS,Version=v1.0...
Scanning packages for runtime.json files...
Restoring packages for Xamarin.iOS,Version=v1.0/win...
Resolving conflicts for Xamarin.iOS,Version=v1.0/win...
Restoring packages for Xamarin.iOS,Version=v1.0/win-x64...
Resolving conflicts for Xamarin.iOS,Version=v1.0/win-x64...
Restoring packages for Xamarin.iOS,Version=v1.0/win-x86...
Resolving conflicts for Xamarin.iOS,Version=v1.0/win-x86...
Unable to find project information for '/Users/t/Downloads/Avalonia-master/samples/ControlCatalog/ControlCatalog.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Animation/Avalonia.Animation.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Base/Avalonia.Base.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Controls/Avalonia.Controls.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Input/Avalonia.Input.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Layout/Avalonia.Layout.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Styling/Avalonia.Styling.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Visuals/Avalonia.Visuals.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/obj/project.assets.json
Writing cache file to disk. Path: /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/obj/project.nuget.cache
Persisting dg to /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/obj/ControlCatalog.iOS.csproj.nuget.dgspec.json
Failed to restore /Users/t/Downloads/Avalonia-master/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj (in 383 ms).

NuGet Config files used:
/Users/t/Downloads/Avalonia-master/NuGet.Config
/Users/t/.config/NuGet/NuGet.Config

Feeds used:
https://api.nuget.org/v3/index.json
https://nuget.avaloniaui.net/repository/avalonia-devdeps/index.json

Unable to find project information for '/Users/t/Downloads/Avalonia-master/samples/ControlCatalog/ControlCatalog.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Animation/Avalonia.Animation.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Base/Avalonia.Base.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Controls/Avalonia.Controls.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Input/Avalonia.Input.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Layout/Avalonia.Layout.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Styling/Avalonia.Styling.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Avalonia.Visuals/Avalonia.Visuals.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/iOS/Avalonia.iOS/Avalonia.iOS.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Unable to find project information for '/Users/t/Downloads/Avalonia-master/src/Skia/Avalonia.Skia/Avalonia.Skia.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
Restore failed.

@ili
Copy link
Contributor

ili commented Feb 1, 2021

@FloridaMatt please look at https://github.com/AvaloniaUI/Avalonia/blob/master/Documentation/build.md

Also check global.json near the Avalonia.sln there is an actual SDK used, you should either install provided version, or define one you installed

@robloo
Copy link
Contributor

robloo commented Mar 12, 2021

@ili quite a lot of progess. its probably ready for people to start beta testing... expecting a few rough edges to help find what still needs doing.

Really looking forward to seeing the outcome of this. I'm especially concerned about performance which no one seems to have gotten right at this point. XAML-tech is very resource intensive as you know.

Anyway, the status of iOS and other mobile backends may drastically tip the scales towards Avalonia very quickly. I hope the code is made public and integrated into the main repo soon.

@kekekeks
Copy link
Member

@robloo somewhat functional iOS support is available in 0.10. It's a bit broken on actual devices (black screen until you rotate the screen for some reason), but everything works perfectly in emulator.

@ili
Copy link
Contributor

ili commented May 21, 2021

Just a point about current experience. Avalonia requres significant memory & processor resources. For ex one of my test devices - Samsung J5 DUOS (J500H) fails to even start demo application (not control catalog, but one page demo app)....

XamarinForms applications worsk fine at the same time... Google Chrome too (i do suppose Chrome on Android uses Skia?).

@robloo
Copy link
Contributor

robloo commented Jul 17, 2021

Any updates on this?

  1. I last heard somewhere else that most of the iOS work was being done in a private repo somewhere. I assume that is for a commercial customer. I have a small concern that work will never actually get back into Avalonia publicly.
  2. It was planned to have the mobile backends complete for 0.11. I haven't seen a lot of progress on it and the year is already over halfway complete. I'm not sure if this will stabilize in time. Android was made to work again though no packages were released, iOS we hear is in better shape.
  3. x:Load (deferred loading of entire branches of the visual tree) is almost mandatory for mobile devices. I've so far heard no mention of something similar in Avalonia. This was learned with UWP and also is quite important with the Uno Platform. XAML performance on mobile is difficult and it is likely not possible to load the entire visual tree during initialization of a view as done on desktop.

@maxkatz6
Copy link
Member

@robloo that's true, that iOS and Android backends work now, although some planned functionality is still missed (such as IME, which only recently came to Linux and is coming to Windows). These backends are not considered as production ready, and that's the only reason why Avalonia.Android wasn't updated on nuget (but IMO it could be, just with preview tag).
I am not sure about forked internal iOS implementation, and if it was merged back or does it make any difference. @kekekeks

Also, tbh, I wouldn't really push development of these backend until we have stable .NET 6 that can replace old MonoXamarin. But it's my personal opinion.

x:Load (deferred loading of entire branches of the visual tree) is almost mandatory for mobile devices

I would argue that it makes huge difference. But if developers use it everywhere it is possible and makes sense, in overall it actually might make that difference. Anyway, it should be discussed here #1434

@shanoaice
Copy link

I'm curious if there is any guide about developing AvaloniaUI Apps for mobile device? Is there any special changes needed to be made in my code for it to work on mobile platforms, or should I just add Avalonia.Mobile package to my codebase and add corresponding build targets for it? Sorry for interruption if this question is Off-Topic.

@kekekeks
Copy link
Member

@shanoaice

Note: mobile backends are not considered to be production-ready. E. g. iOS one has issues on some devices when screen is black until the first screen orientation change. If you are really interested in mobile support, contact us, we might figure something.

Answer: You can keep your entire app in a netstandard2.0 library (or keep it as is and use multitargeting with conditional compilation to remove the Program class and Avalonia.Desktop reference from your netstandard2.0 build) and reference it from Xamarin.iOS/Xamarin.Android project. Then you can just use any of your UserControl's as the main view.
For iOS it's rather simple, you just create an empty app and replace the AppDelegate with

    [Register("AppDelegate")]
    public partial class AppDelegate : AvaloniaAppDelegate<App>
    {
        
    }

where App is the App class from your application. The IApplicationLifetime that you receive in OnFrameworkInitializationCompleted will implement ISingleViewApplicationLifetime rather than IClassicDesktopStyleApplicationLifetime, so your App.xaml.cs will have something like this

        public override void OnFrameworkInitializationCompleted()
        {
            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime)
                desktopLifetime.MainWindow = new MainWindow();
            else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime)
                singleViewLifetime.MainView = new MainView();

            base.OnFrameworkInitializationCompleted();
        }

Those are the only required changes to your application aside from the lack of Window class support on mobile platforms. If you are only using a single view like our control catalog, no other changes are required, you can keep the codebase nice and clean.

@ili
Copy link
Contributor

ili commented Oct 7, 2021

Just FYI I'v checked Avalonia.AndroidTestApplication on my Samsung J5 DUOS (J500H) now it can start and even responsive. ControlCatalog.Android starts too but hungs (not responsive), i do suppose this is because of some error with libEGL i see in debug output (hundreds of them):

[libEGL] eglCreateWindowSurface: native_window_api_connect (win=0x7b0f5008) failed (0xffffffea) (already connected to another API?)
[libEGL] eglCreateWindowSurface:481 error 3003 (EGL_BAD_ALLOC)

Also I'v just finished small project where Avalonia was used for simple UI rendering on SCV500 device (Ubuntu Core, rendering to the framebuffer). Simple ui means TextBlocks, Images, Grids, and ProgressBar. Success! :)

I do writing this to make a point:

  1. Some optimization was done for past months, and that is really cool! :)
  2. In all the cases i do see long startup time (Skia or smth else takes a long time to initialize)

In general - things are comming better :))

@ili
Copy link
Contributor

ili commented Feb 10, 2022

Things are coming better!

Coming back with my poor old test phone with the latest master. Control catalog app starts & responsive. I do see gaps on pages switching (in general problems are on pages with "many" controls, for ex, 6 seconds are needed to show calendar in date picker), also long startup (splash is shown for 10 seconds and then black screen for 30 seconds), but anyway it works and alive!

Super, great job is done!

PS also tried net6-android, from #6922 hangs as on previous test with plenty

[libEGL] eglCreateWindowSurface: native_window_api_connect (win=0x7b0f5008) failed (0xffffffea) (already connected to another API?)
[libEGL] eglCreateWindowSurface:481 error 3003 (EGL_BAD_ALLOC)

@maxkatz6
Copy link
Member

Mobile backends are now published on nuget. They are stable for net6, but some features are not there yet (file picker...). I am closing this issue. Please open a new one for specific issues/missing features, if there is no one existed.

Templates
AvaloniaUI/avalonia-dotnet-templates#79

And sample app
https://github.com/AvaloniaUI/Wordle-onia

@robloo
Copy link
Contributor

robloo commented Mar 10, 2022

And plans for single project support to combine Android/iOS? I notice it is still all separate projects.

@maxkatz6
Copy link
Member

maxkatz6 commented Mar 10, 2022

@robloo at least when Microsoft will complete them. And so far they seems to be very limited to the maui (in terms of resources/assets). Which means, not earlier than maui release, unless somebody will try to experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests