[android-devel] mandroid not yet open source?

Jonathan Pryor jonpryor at vt.edu
Fri May 6 12:36:14 UTC 2016


On May 5, 2016, at 8:43 PM, Hans Schmidt <hans.schmidt9306 at gmail.com> wrote:
> I compiled the recently open sourced Xamarin.Android code from github on Linux (current ubuntu). Then if I try to compile an app with xbuild, I get the following error:
> 
> : error XA0020: Could not find mandroid!
>     Task "ResolveSdks" execution — FAILED

`mandroid` is two different things, because…naming is hard?

There's mandroid.exe…which is dead. (DEAD! Huzzah!) It was responsible for various forms of license checking and “protected” the mono runtimes (…because it would otherwise be too hard to `unzip` the .apk and grab libmonosgen-2.0.so?).

(Look, I just *implemented* the logic, I didn’t agree with all of it. ;-)

Anyway, mandroid.exe’s license checking purpose was killed in C6SR3 (Xamarin.Android 6.0.3) and C7 (Xamarin.Android 6.1), and the open-sourced code is based on master (to eventually be C8/Xamarin.Android 6.2?).

The *other* mandroid is $prefix/lib/mandroid, which stores various utilities such as class-parse.exe, and this is what the XA0020 error is trying to complain about:

	https://github.com/xamarin/xamarin-android/blob/59ec488/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs#L129

However, what it’s *actually* looking for is $prefix/bin/generator:

	https://github.com/xamarin/xamarin-android/blob/59ec488/src/Xamarin.Android.Build.Utilities/MonoDroidSdk.cs#L25-L38
	https://github.com/xamarin/xamarin-android/blob/59ec488/src/Xamarin.Android.Build.Utilities/Sdks/MonoDroidSdkBase.cs#L37-L66
	https://github.com/xamarin/xamarin-android/blob/59ec488/src/Xamarin.Android.Build.Utilities/Sdks/MonoDroidSdkUnix.cs#L38-L42

Same basic *idea*, though: to verify that the Xamarin.Android SDK is sane, we check for a file…which doesn’t exist, because nothing creates it.

(Because I was in a rush, never built this on Linux, and don’t have a “clean” OS X environment for testing either…)

You should be able to hack it to make it work; PR’s welcome, or wait until one of us gets around to it. As a vague guess for a starting point, what you’d need to do is:

1. *Fully* build external/Java.Interop. The default xamarin-android build only includes pieces of it.
2. Copy external/Java.Interop/bin/$(Configuration) into bin/$(Configuration)/lib/mandroid
3. Create bin/$(Configuration)/bin/generator, as a shell-script to invoke bin/$(Configuration)/lib/mandroid/generator.exe
4. Profit by using tools/scripts/xabuild.

Then there’s the closely related question of how to *properly* build this; should this be make(1)-based, and done in the Makefile, or can we get MSBuild/xbuild to do this for us? I’d like to keep as much in MSBuild as possible…but we’re dealing with shell scripts, which will need to be +x, so it’s probably easier/saner to require Makefile there…

 - Jon



More information about the android-devel mailing list