mdtool, build android apk on mac

3k views Asked by At

I have a Xamarin project am looking to build a Android apk using mdtool, and the command line. Here is the setup :

I have a mac mini - Xamarin Studio installed on it, I have the solution which build no problem. Now from the command line this is what I an trying to do

#REM Traverse to the folder which holds the .sln file
cd One/Xamarin/Android/OneAndroid 

#REM start the build using mdtool
'/Applications/Xamarin Studio.app/Contents/MacOS/mdtool' -v build OneAndroid.sln

The above completes the build for me , however I do not get an apk file. Could someone share with me which option needs to be added onto mdtool to generate an apk file?

Thanks Rajesh

I understand I maybe missing some parameters for mdtool

2

There are 2 answers

14
Tom Opgenorth On BEST ANSWER

Use XBuild to compile the APK, for example:

xbuild MyXamarinAndroidApplication.csproj /p:Configuration=Release /t:SignAndroidPackage

This will compile the project in release mode and generate a signed and unsigned APK. If you just want an unsigned APK:

xbuild MyXamarinAndroidApplication.csproj /p:Configuration=Release /t:PackageForAndroid

It's worth noting that you have to specify a .csproj, not a .sln. If you give it a solution file, you'll get an error complaining that it can't find the "SignAndroidPackage" target.

2
Jon Douglas On

Check out the build process documentation from Xamarin: http://docs.xamarin.com/guides/android/advanced_topics/build_process/offline.pdf