androidmsbuildmonodevelopapkmdtool

how to create a build file to build mono android project and generate myproject.apk file.?


I have a mono android project. I can use monodevelop to build the apk of my project. But I want to write a build file (like we do using ANT) with targets that can generate the .apk file.

Please point me to the right direction.

I have figured out the we need to use mandroid.exe to generate .apk from the .dll. the log shows that there is a target called _Manddroid that monodevelop's build tool runs. This target in turn runs following command

C:\Program Files\MSBuild\Novell\mandroid.exe -v --nosign --sdk-dir="C:\Android\android-sdk" --builddir="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\android" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2" --framework-dir="C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0" -S="C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\obj\Debug\res" --package="helloShikha.helloShikha"   --nolink --abi="armeabi" --java-sdk-dir="C:\Program Files\Java\jdk1.6.0_30" --debug --sdk-platform="8" "C:\Users\Sikha\Documents\Projects\helloShikha\helloShikha\bin\Debug\helloShikha.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" "C:\Program Files\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll"

When I try to copy paste the above command on cmd nothing happens. Any Idea what I am missing here?


Solution

  • I used following command and it generated the .apk file for me.

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe myproject.csproj /t:Package
    

    I tried using .sln file but was receiving an error : target Package does not exist in the project. I opened the myproject.csproj file and figured out that this file imports Novell.MomoDroid.CSharp.Targets which in turn imports the Novell.MonoDroid.Common.Targets

    The target "Package" is present in the file Novell.MonoDroid.Common.Targets.