четвер, 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

вівторок, 8 січня 2019 р.

build #1475

xamarin-android-linux build #1475 (Dec 6, 2018)

Debian 10
Mono JIT compiler version 5.18.0.225
Microsoft (R) Build Engine version 16.0.0.0 for Mono
NuGet Version: 4.7.0.5148
.NET Command Line Tools (2.1.502)
VSCode 1.30.1
C# extension 1.17.1

nuget issue:
The reference assemblies for framework "MonoAndroid,Version=v1.0" were not found.

solution: as usually, add TargetFrameworkRootPath to the csproj file (or add the symbolic link to the MonoAndroid folder into /usr/lib/mono/xbuild-frameworks ).

<PropertyGroup>
  <AndroidSdkDirectory>/home/.../my_sdk_dir</AndroidSdkDirectory>
  <TargetFrameworkRootPath>/usr/lib/mono/xbuild-frameworks/</TargetFrameworkRootPath>
</PropertyGroup>


Also it asks to remove "armeabi" from AndroidSupportedAbis

Then it builds TheLittleThingsPlayground project.

P.S. Monodevelop 7.7 shows all files twice in the project tree for Android, and needs a hack (Sdk tag) to remove the MonoAndroid error (there should be a normal way to do it, but I don't know how to do it today):

    <Sdk Name="Microsoft.NET.Sdk" />
<!--
    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-->
    <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>


неділя, 9 вересня 2018 р.

Azure on Linux locally

This August I've tried to run Azure on Linux locally.

I've spent ~10 hours to understand how to configure it on Linux and how to deal with the existing issues to create and run a simple HTTP trigger.

Normally it should not be so hard.

Issues:

* it doesn't work for my locale, so I have to set en_US.utf8 , otherwise "func extensions install" doesn't work; https://github.com/Azure/azure-functions-core-tools/issues/519

* documentation didn't mention that I should run it using the "-build" flag for C#-based projects, i.e. "func host start --build"; https://github.com/MicrosoftDocs/azure-docs/issues/13253

* the latest code that have worked for me on Debian 9 was on the "artful" repository;

четвер, 23 серпня 2018 р.

ConferenceVision build


It was possible to build https://github.com/Microsoft/ConferenceVision

Some details doesn't work, but it builds and run and I was able to get a simple Achievement.

https://github.com/igorkovalchuk/ConferenceVision/tree/linux-build

README-LINUX.md

This application needs Android => 5.0 and it needs lot of Internal Storage to install. I've set 1.5 Gb

The build took 2.5 minutes.

P.S. Don't change the emulator's properties after you have created it, otherwise this application will crash when you open a camera. Probably it doesn't see the sdcard or a file storage after that.



середа, 22 серпня 2018 р.

build #993


I've moved to Xamarin.Android build #993 and Mono 5.14 and nuget,
including the new VSCode 1.25.1 and C# plugin and Monodevelop 7.5

Also I am using the dotnet sdk - it is necessary to build the netstandard2.0 projects and restore the nuget packages.

And I've updated the documentation:
https://goo.gl/mQvTJk

P.S. Monodevelop 7.5 doesn't open the Droid projects.

четвер, 16 серпня 2018 р.

issues :: AotAssemblies and release settings


Don't forget to use <AotAssemblies>false</AotAssemblies> when you build the release apk on Linux.
But I may be wrong, because things are changing from time to time.

Other settings in "Release|AnyCPU" section may include this:

    <DebugSymbols>true</DebugSymbols>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>


    <AndroidKeyStore>True</AndroidKeyStore>
    <AndroidSigningKeyStore>/mypathtojks/my_xamarin_keystore.jks</AndroidSigningKeyStore>
    <AndroidSigningStorePass>mystorepass</AndroidSigningStorePass>
    <AndroidSigningKeyAlias>myandroidalias</AndroidSigningKeyAlias>
    <AndroidSigningKeyPass>mykeypass</AndroidSigningKeyPass>

<!--
    <AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a;armeabi</AndroidSupportedAbis>
-->

    <AndroidSupportedAbis>armeabi-v7a</AndroidSupportedAbis>

    <AndroidLinkMode>SdkOnly</AndroidLinkMode>


You may try to use AndroidLinkMode = Full, but for me it doesn't work today.

issues :: msbuild :: "MonoAndroid,Version=v1.0" not found


If msbuild outputs the next error:

The reference assemblies for framework "MonoAndroid,Version=v1.0" were not found.

Please add the TargetFrameworkRootPath to your Droid csproj:

<PropertyGroup>
<AndroidSdkDirectory>/home/myuser/my-android-toolchain-sdk-path</AndroidSdkDirectory>
<TargetFrameworkRootPath>/usr/lib/mono/xbuild-frameworks/</TargetFrameworkRootPath>
</PropertyGroup>

Thanks to Nihal Talur for the TargetFrameworkRootPath advice.

неділя, 29 липня 2018 р.

xamarin-forms-android-linux-tools :: emulator path

If you have this message:

PANIC: Missing emulator engine program for 'x86' CPU.

The newest versions of SDK have a new path

${ANDROID_SDK}/emulator
instead of ${ANDROID_SDK}/tools

https://stackoverflow.com/a/50118004

пʼятниця, 20 липня 2018 р.

funny :: a-no-debugger-land

I have working almost a year on a Xamarin.Forms project where on Linux platform I don't know how to run a debugger. Now I have returned back to the Android, but now I tend to avoid the debugging but writing the logs))

I don't know, maybe it is possible to run the debugger on the Linux+Android+Xamarin.Forms platform, but I afraid that it will take a lot of time to configure, so I haven't configured it.

P.S. I've found an important project which solves this problem. I have not tried it on Linux.

https://github.com/VysotskiVadim/vscode-xamarin-debug
https://github.com/Microsoft/vscode-mono-debug/pull/34
https://youtu.be/RnWTy1D031k

понеділок, 19 лютого 2018 р.

8.0 build

On my previous xamarin-android I can't build and run 8.0 projects - I am getting this exception: I/MonoDroid( 2345): System.MissingMethodException: Method 'Android.Views.View.set_Focusable' not found.

So, I decide to try a newer build #610 (24 Oct 2017 14:05:40) - Revision: a08f8851e2db7c5c44ead3c9a29afc7c2ebc05e4
It works for me:

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

or

https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-linux/lastStableBuild/Azure/processDownloadRequest/xamarin-android/oss-xamarin.android_8.1.99.90.orig.tar.bz2

cd oss-xamarin.android_v8.1.99.90_Linux-x86_64_HEAD_a08f885/bin/Debug/lib

ln -s xamarin.android/xbuild

ln -s xamarin.android/xbuild-frameworks/

середа, 31 січня 2018 р.

issues :: what to do if I can't build apk on Linux

Today I can't because we have migrated to TargetFrameworkVersion v8.0 and I've got a new issue.

But I still can work with the PCL:

Easiest and fastest solution for me today is to build the apk using the macincloud (using the "x86" ABI for emulator and disabled the "Use Shared Mono Runtime" option), and then using the xfast.sh to work on Linux.

Normally I should try to fix the current Droid build issue, but I have not enough time yet.
I can't say does that library work or not, but now I can build and run the PCL.

Build error (Droid project):

Xamarin.Android.Common.targets (_UpdateAndroidResgen target) ->

.../Droid/obj/Debug/__library_projects__/Xamarin.Android.Support.Design/library_project_imports/res/values-v26/values-v26.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
.../Droid/obj/Debug/__library_projects__/Xamarin.Android.Support.v7.AppCompat/library_project_imports/res/values-v26/values-v26.xml(2): error APT0000:  Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

четвер, 25 січня 2018 р.

issues :: NuGet client version 3.0.0

The 'Xam.Plugin.SecureStorage 1.0.11' package requires NuGet client version '3.0.0' or above, but the current NuGet version is '2.12.0.0'.
I don't know how to resolve it today. Probably I will need to take another/older version of this package (Xam.Plugin.SecureStorage)  if possible.

P.S. The easiest solution that I've found is here:
https://stackoverflow.com/questions/38118548/how-to-install-nuget-from-command-line-on-linux
is to download the nuget.exe 3.3.0 to the project folder and run it with mono:
mono nuget.exe restore

вівторок, 14 листопада 2017 р.

tips and tricks :: TargetFrameworkVersion v8.0

Today I was creating a new template - I've created a new project and updated all nuget packages in Visual Studio (on the non-Linux computer), so I have got a new template with Xamarin.Forms version 2.4.0.74863 , but ... I can't compile it.

error XA0001: Unsupported or invalid $(TargetFrameworkVersion) value of 'v8.0'. Please update your Project Options.

In the configuration files I have this:

packages.config
<package id="Xamarin.Forms" version="2.4.0.74863" targetFramework="monoandroid80" />
(and there are a lot of "monoandroid80" packages now)

*.Droid.csproj
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>

My compiled Xamarin.Android contains only v7.1 , so I've made a temporary trick (and maybe this is a very incorrect thing):

cd xamarin-android/bin/Debug/lib/xbuild-frameworks/MonoAndroid
ln -s v7.1 v8.0

Now I can build that project and run it - this simple project works. How it will be with a more complex project - I don't know, probably it will not work.

Normally I should re-compile the Xamarin.Android on Linux from zero (or maybe not from zero) - but I don't have many free space today on my ssd, so I don't want to try.