Forum Visual Studio

How to deploy to multiple emulators via msbuild

I need to test my application on multiple instances of the MonoForAndroid_API_10 emulator. I have made duplicate AVDs and can manually install and launch the app on each via the Visual Studio deploy action. I would like automate this process. When I make a change in the app I want to run a batch file to compile (I have this) and then deploy (and run if possible) on each AVD. The page gives information on "build targets" but there is not enough detail. How do I specify the emulator that will receive the .apk? I am hoping I can make a batch file with msbuild commands, or a command lines to install an apk, on each designated emulator.

Can be done?

Best Answers


  • RyanSavilleRyanSaville USMember

    Thanks, that works great. I had to add "-ExecutionPolicy ByPass" to the command line, but then it works perfectly.

    I then tried using the adb shell commands to run the application, but I get the error "Permission Denial: starting Intent {...} from null (...) not exported from uid 10199. I tried adding android:exported="true" in the manifest, which allowed the activity to start, but the application failed with a popup message saying "Unfortunately, [app label] has stopped. The app does run when started manually.

    Any ideas on this?

  • DeanEllisDeanEllis USXamarin Team Xamurai
    edited November 2013


    Take a look at the AndroidManifest.xml in the obj/Debug/android folder and its the activity that has

    <action android:name="android.intent.action.MAIN" />

    on it that is the one you will want to run.

  • RyanSavilleRyanSaville USMember


    My manifest file does not have an element. I looked in a couple of Android demo projects and none of them had an element in their manifest files.

    I had added as a child inside of the element, which allowed
    adb.exe -s [emulator] shell am start -n [package]/.main
    to execute.

    Should I be adding an element?

Sign In or Register to comment.