Question

My company owns several business licenses for Xamarin.Android, and we'd like to use this on our CI server. However, it seems that I'd need to install the full Xamarin suite on my CI server including Visual Studio Pro to make this work. My question is, using the vanilla Xamarin.Android package, how can I activate it?

It seems that installing this on its own adds the Xamarin.Android tools and libraries to build with but there is no way to activate it that I can find, so when I attempt to build using MSBuild, the build fails with this error:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(299,2): error XA9008: Building from the command-line requires aÿBusinessÿLicense.

Now, after some googling, I have found that the activation tool is called "mandroid.exe", which can be found in C:\Program Files (x86)\MSBuild\Xamarin\Android - although I have found references to this being in the 64-bit program files too.

Unfortunately, I can't find any suitable documentation on this tool. Every time I find a thread where someone discusses this, someone from Xamarin jumps in and says "contact support@xamarin.com". After a while I did that but two business days later there still is no response and I've got deadlines to meet so I thought it might be helpful for everyone involved for us to publicly document this process.

The best thing I've found comes from a thread on the Xamarin mailing list which references this invocation:

mandroid.exe --activate --name "NAME" --company "COMPANY" --email "EMAIL" --phone "PHONE" --code "ACTIVATION CODE"

I have also discovered another variant of this invocation that looks like this:

.\mandroid.exe –activate –activation-name="NAME" –activation-phone="PHONE" –activation-company="COMPANY" –activation-code="CODE" –activation-email="EMAIL"

I've tried many permutations of my account data here using both invocations - using the activation code from the products page on the Xamarin store. No matter what though, this error occurs:

\mandroid.exe : monodroid: error XA9997: Incomplete data provided to complete activation

In the "problems activating?" section of the products page, it says this:

In Mono for Android 1.0.21316 and later, if activation within Visual Studio fails then a MfaActivation.dat file will be created within the Documents folder. Select this file below.

Perhaps there's some way to force this file to be created by mandroid.exe? That would be very helpful. While I imagine that offline activation is the only way to make this work, I would accept any answer that involves uploading MfaActivation.dat or otherwise invoking the online activation machinery as well.

Was it helpful?

Solution

Update - I'm afraid that the below steps no longer work. Xamarin has updated their activation system to activate by a different method for newer versions.

In the end I had to install Xamarin Studio as part of the Chef configuration and just instruct administrators to manually activate the software as part of creating a new build node. I had no luck trying to reverse engineer a fix, and if I did, it would probably just break again.


It turns out that I almost had it correct. The second invocation I specified is actually the correct way to call this command but the -- part was apparently converted to a token by some blog software somehow.

The --activate verb will perform an online activation with Xamarin's servers, so I'm still not sure how you'd do it without an internet connection.

For reference, here is how I did it:

mandroid.exe -v --activate --activation-name "(NAME)" --activation-phone "(PHONE_" --activation-email "(EMAIL)" --activation-company "(COMPANY)" --activation-code "(CODE)"

I'm not sure about the significance of the -v switch, but perhaps that would make it output debugging info if there was a problem.

You must enter all the information exactly as specified on your products page - select one of your licenses and select "problems activating?". However, you will need to enter the licensee name - i.e. the user who owns the license in the --activation-name parameter which must correspond to the --activation-code parameter.

After doing this you can call mandroid with the --activated switch which returns an exit code:

PS> & .\mandroid.exe --activated
PS> $LastExitCode
0

You will also be able to reload the products page and you should see that your license for the chosen user has a new computer registered to it.

This does use up another activation but if you e-mail the support team you can sign the build server agreement and then I assume they can set you up with additional activations for your build nodes.

It's a shame that this wasn't documented better because this has wasted my time for several days. Hopefully this will be helpful to someone else with the same situation.

OTHER TIPS

From Xamarin documentation, we can see

http://docs.xamarin.com/guides/cross-platform/ci/configuring_tfs/

"Visual Studio Professional (or greater) must be installed on the Team Foundation Server along with licensed copies of Xamarin.Android and Xamarin.iOS to support development of Android and iOS mobile applications via the Team Foundation Server."

So I assume that in all cases you need to have VS + Xamarin products installed and activated.

I might be wrong, so the best way is to contact Xamarin support, http://xamarin.com/support

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top