четвер, 12 лютого 2026 р.

MAUI Android on Linux

These days I compiled first MAUI app on Linux for Android.

 

Using

sudo dotnet workload install maui-android

this installs additional files to /usr/share/dotnet/ 


Using VS Code to create the .NET MAUI App.


I have not "Signed in" to use the C# Dev Kit yet, but looks like it works. I don't need its special features yet.


Updating .cproj - using only net10.0-android


<!--
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
-->

<TargetFrameworks>net10.0-android</TargetFrameworks> 


And probably VS Code works normally with Fast  Deployment, but I want to use the command line.


I should use 

dotnet run -f net10.0-android -c Debug 

to upload all necessary files, dlls, to the .__override__ directory, 
and run this app on emulator, otherwise I get

'No assemblies found in '/data/user/0/com.companyname.mauiapp1/files/.__override__/x86_64' or '<unavailable>'. Assuming this is part of Fast Deployment. Exiting...'

Then, probably, I will be able to use 

dotnet build -f net10.0-android -c Debug 

to update the corresponding dll and this or similar script for the Fast Deployment.


P.S. One issue is that VS Code caches the first JDK location, so I need to update this location in .NET MAUI: Configure Android every time.

четвер, 11 лютого 2021 р.

zipalign issue

 (_Sign target) ->
 

  /usr/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2457,2): error ANDZA0000: W/zip     (24714): copy of 'assemblies/Xamarin.Android.Support.Compat.dll' failed [..../Droid/App.Droid.csproj]
 

  /usr/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2457,2): error ANDZA0000: zipalign: failed rewriting '..../Droid/obj/Debug/android/bin/com.example.app.apk' to 'bin/Debug//com.example.app-Signed.apk' [..../Droid/CentroForms.Droid.csproj]


Solution: delete apk files and run build.sh again
cd Droid/bin/Debug
rm *.apk

P.S. Today, 2021.03.23 it works without errors (after Android SDK update).

Mono: 6.12.0.122    VS Code: 1.54.2    Android/Sdk/build-tools/29.0.2/

середа, 4 листопада 2020 р.

вівторок, 3 листопада 2020 р.

Guid should contain 32 digits with 4 dashes

Just in case: beware those "-" in the .sln file, when you have this failure in the VSCode ...


[fail]: OmniSharp.WorkspaceInitializer
        The project system 'OmniSharp.MSBuild.ProjectSystem' threw exception during initialization.
System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).


-        {12345678-1234-1234-1234-123456789012}.Production|Any CPU.ActiveCfg = Production|Any CPU
-        {12345678-1234-1234-1234-123456789012}.Production|Any CPU.Build.0 = Production|Any CPU
        {12345678-1234-1234-1234-123456789012}.Production|iPhone.ActiveCfg = Production|iPhone
        {12345678-1234-1234-1234-123456789012}.Production|iPhone.Build.0 = Production|iPhone


четвер, 9 липня 2020 р.

Optimize, AndroidLinkMode, big project and fast deployment

1. Set Optimize = false for Debug
otherwise I have
run-as: package not debuggable

If you have a large project and [INSTALL_FAILED_CONTAINER_ERROR]

2. Copy assemblies (dlls) to .__override__ if you need AndroidLinkMode = SdkOnly.
3. Alternatively to SdkOnly we may set AndroidUseAapt2 = true

субота, 28 грудня 2019 р.

This project is currently disabled (12.2019)

Project xamarin-android-linux
Xamarin.Android master Linux build

This project is currently disabled, because I don't see any new builds after Apr 2019
(although I see some strange new pipelines for Linux, xamarin-android-linux-pr-pipeline for example, but without artifacts).

https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/

Last version that I've tried: #2194 Apr 17, 2019
xamarin.android-oss_9.2.99.172.tar.xz

I've spent a lot of time but it doesn't work for me to compile and run a complex project. I don't have more time to try.

But it was possible to compile and run a simple application on an Android 4.4 device and on the emulator: template-3.1.0.637273-8.1-ns2.0 based on Xamarin.Forms 3.1

Also it has an unfixed issue for Android 4.4:
https://github.com/xamarin/xamarin-android/issues/3314
so it is necessary to insert into Debug/Release csproj section:
<AndroidAapt2LinkExtraArgs>--no-version-vectors</AndroidAapt2LinkExtraArgs>


P.S. I wasn't able to run some new templates because of this issue:https://github.com/xamarin/Xamarin.Forms/issues/7602
But it is possible to run 4.3.0.851321-pre3 based template.

P.P.S. updated fast.sh for new versions of Xamarin.Forms and Android:

ANDROID_OVERRIDE_DIR=/data/user/0/com.example.sampleresources/files/.__override__

https://github.com/igorkovalchuk/xamarin-forms-android-linux-project-templates/blob/master/template-4.3.0.851321-pre3/fast.sh

- - -

Mono JIT compiler version 6.6.0.161 (tarball Tue Dec 10 10:37:10 UTC 2019)

msbuild version 16.3.0-ci for Mono

NuGet Version: 5.2.0.6090

dotnet version 2.2.402