2014-01-24 44 views
5

我有一個Xamarin項目正在使用mdtool和命令行構建Android apk。 這裏是設置:mdtool,在mac上構建android apk安卓版。

我有一個mac mini-Xamarin Studio安裝它,我有解決方案,沒有問題。 現在在命令行中,這是我一個試圖做上述

#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 

完成構建適合我,但我沒有得到一個apk文件。 有人可以與我分享哪些選項需要添加到mdtool上以生成apk文件嗎?

感謝 拉傑什

我明白我可能錯過了一些參數mdtool

回答

6

使用XBuild編譯APK,例如:

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

這將在發佈模式下編譯項目並生成簽名和聯合簽名APK。如果你只是想要一個無符號的APK:

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

值得一提的是,你必須指定一個.csproj,而不是一個.sln。如果你給它一個解決方案文件,你會得到一個錯誤,抱怨說它找不到「SignAndroidPackage」目標。

+0

這是比較明確的答案 –

+0

你好湯姆我在哪裏可以安裝xbuild?我是否從莫諾獲得Xamarin的一部分? – Raj

+1

這是Mona的一部分,由Xamarin安裝。在我的Mac上,它可以在'/ usr/bin/xbuild'找到。不確定它在Windows上的位置 - 但在Windows上,您可以使用MSBuild。 –