How to create apk on mac using xbuild\msbuild with multiple project files

871 views Asked by At

I have being trying to create an APK file for my Android App. The Project itself contains multiple .csproj files so I need to include them as well as packages and other necessary information. Can you either do this by selecting the .sln file which works to create my IPA file using mdtool. But for me will just run successfully(doesn't have any error) but will not create the APK file. So I thought I would have to use either /t:PackageForAndroid or /t:SignAndroidPackage. But I get the error message PackageForAndroid not found in project. I was unsure what to do here if the problem is that I have to target a file or node in my project that is matched to that target(if this is correct where could I find this?) If I just have to use either of these as target how should it work correctly as I also tried it with MSbuild and this did not work either.

I have tried to use Debug and Release as the /p:Configuration both have the same result. Ad Hoc doesn't work. Then I tried to use a .csproj file as I seen most examples contain that, but this is not working right for me because I have multiple .csproj files as well as a lot of other information needed to build the app. I have tried to use the Include, command unsuccessfully, trying to target all .csproj files as well as just targeting the main build but this has not worked.

How can I create this APK file correctly? I think I am close as if I am not getting any error messages, I am just not creating it correctly. I have on the terminal on the mac and using Bamboo(as this is where I get the project from)and the results are the exact same. Also note that this project successfully builds on the emulator and on an android phone so there are no problems with the project itself.

1

There are 1 answers

0
Ciaran Donoghue On BEST ANSWER

I fixed the messages by re-installing the msbuild from a github repo, then I used which msbuild to find my location of msbuild. Then I added it as an executable in Bamboo. Then I added a command task in my bamboo plan which then add the MSBuild as its executable and the argument was this:

CustomerApp.Droid/CustomerApp.Droid.csproj /t:SignAndroidPackage /p:Configuration=Release