Raj
Raj

Reputation: 77

mdtool, build android apk on mac

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

Upvotes: 5

Views: 3062

Answers (2)

Tom Opgenorth
Tom Opgenorth

Reputation: 1511

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.

Upvotes: 6

Jon Douglas
Jon Douglas

Reputation: 13176

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

Upvotes: 1

Related Questions