AvaloniaUI / AvaloniaMauiHybrid

Brings templated controls, pixel perfect rendering, animations, styling and composition to Maui
MIT License
169 stars 13 forks source link

Cannot run AvaloniaSample.Android #11

Closed joergpichler closed 7 months ago

joergpichler commented 11 months ago

When I clone the repo, open solution in latest VS Community (17.7.4) and select AvaloniaSample.Android as startup project, it does not show the Android Emulator next to the run button. When I switch startup project to MauiSample it appears.

I do not have issues with running Maui Apps or even the avalonia.xplat template.

Any ideas?

Edit: It seems that for whatever reason <UseMaui>true</UseMaui> seems to be the culprit. If I add this to a new avalonia.xplat app created from template I have the same behavior that I can no longer see the Android Targets in Visual Studio and thus cannot deploy it

maxkatz6 commented 11 months ago

Works fine in Rider. Possibly needs to be reported to the VS studio team.

joergpichler commented 11 months ago

Apparently it was just fixed some days ago internally - waiting for the fix to be released https://developercommunity.visualstudio.com/t/Adding-UseMaui-to-NET-Android-app-hides/10386552

joergpichler commented 11 months ago

Just to bring this to its conclusion: I tried the latest preview version of VS and this issue is actually fixed!

But AvaloniaSample.Android crashes after startup with System.InvalidOperationException: 'No page was set on the window.'

maxkatz6 commented 11 months ago

Do you have a stacktrace? And on which device/emulator have you tested it?

joergpichler commented 11 months ago

Sorry for the late answer.

Stacktrace

I tried it in Pixel 5 Emulators for Android 13 & 14

CastelloBrancoTecnologia commented 11 months ago

Just to bring this to its conclusion: I tried the latest preview version of VS and this issue is actually fixed!

But AvaloniaSample.Android crashes after startup with System.InvalidOperationException: 'No page was set on the window.'

Same for me (page was set on the window) when using MediaElement.

Also I have the "not show Android Emulator" problem and cannot start emulator when using https://github.com/hjam40/Camera.MAUI inside MauiControlHost.

Also x:Name (or Name) not works on Maui Native Control inside MauiControlHost

    <avamauictrls:MauiControlHost Grid.Row="1">
        <cv:CameraView
                            x:Name="cameraView"
            WidthRequest="400"
                        HeightRequest="400"
                        BarCodeResults="{Binding BarCodeResults, Mode=OneWayToSource}"
            CamerasLoaded="CameraView_CamerasLoaded"
            BarcodeDetected="CameraView_BarcodeDetected"
            BarCodeOptions="{Binding BarCodeOpts}"
            BarCodeDetectionFrameRate="10"
                            BarCodeDetectionMaxThreads="5"
                            ControlBarcodeResultDuplicate="True"
                            BarCodeDetectionEnabled="True">
        </cv:CameraView>
    </avamauictrls:MauiControlHost>
maxkatz6 commented 11 months ago

Also x:Name (or Name) not works on Maui Native Control inside MauiControlHost

It is expected, you can't use named properties generator on non avalonia controls.

Same for me (page was set on the window) when using MediaElement.

Just to confirm, it's with the sample in this repository?

cesarchefinho commented 11 months ago

Also x:Name (or Name) not works on Maui Native Control inside MauiControlHost

It is expected, you can't use named properties generator on non avalonia controls.

Same for me (page was set on the window) when using MediaElement.

Just to confirm the

Y

Also x:Name (or Name) not works on Maui Native Control inside MauiControlHost

It is expected, you can't use named properties generator on non avalonia controls.

Same for me (page was set on the window) when using MediaElement.

Just to confirm, it's with the sample in this repository?

with the sample in this repository? > Yes and no, i tried also to make a new project and try to use maui.camera (zxzing) to scan an qrcode. dont work...

maxkatz6 commented 11 months ago

@joergpichler @CastelloBrancoTecnologia tried to reproduce it again. And found out why I couldn't reproduce it before - the issue is Xaml Hot Reload feature in Visual Studio, that's why it was working fine in Rider. Also, if you disable xaml hot reload in VS, then it works fine - Tools > Options > Debugging > Hot Reload and unchecking the “Enable Hot Reload” checkbox.

maxkatz6 commented 11 months ago

It seems like XAML HotReload source code is not open as usual...

maxkatz6 commented 11 months ago

I pushed 11.0-preview3 package version, which should fix it. Please note that it also requires Avalonia 11.0.5 as it has some important bug fixes for this package.

staticchange commented 11 months ago

I was having the same issue, turning off hot reload fixes it, but the issue persists for me in 11.0-preview3/11.0.5rc1 with hot reload enabled.