Search code examples
xamarin.androidxamarin-studio

Form not showing up in my Emulator


I have a mac pro. I installed xamarin studio and everything I needed for android development on mac. The first time I created a project I ran it and everything works. I was able to click on a button which counted my number of clicks kind of like a default.

I decided to follow the Android quick start tutorial on Xamarin and when I got done creating the project and ran it nothing showed in my emulator. The controls I created did not show up. All I got on top of the screen was "Deployment Completed" . No error messages either. How do I trouble shoot this? I want to be able to see the screen I created in the Emulator and click on various buttons.

enter image description here

Now I just got an error message and it can be found below.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Warning: No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2047-01-01) or after any future revocation date. (Phoneword)


Solution

  • My guess is that your Android project did not actually get built either because you have selected the wrong configuration and platform pair or because the settings for the configuration and platform pair are not correct.

    When building and running on Android, you want to make sure you change your Platform to AnyCPU and then either choose Debug or Release for your Configuration depending on what environment you are targeting. For building and running on iOS, you would just change the Platform to iPhone Simulator or iPhone.

    See image below for how to access these settings (just click where the red boxes are circled): Xamarin Studio Platform and Configuration Screenshot

    In Xamarin Studio, with your project open:

    1. Click Project -> Solution Options
    2. Choose the Configurations tab
    3. Choose the Configuration Mappings tab
    4. Now change the Configuration dropdown to Debug and the Platform to AnyCPU
    5. Make sure that the Build checkbox is checked next to your shared project (most likely the one at the top) and that the Build checkbox is checked next to your Android project
    6. Now click OK, make sure you have the correct Configuration and Platform are selected
    7. Rebuild the solution and try to run it again

    *Edit: After talk in the comments, the emulator must be unlocked to actually view the running app. To unlock the emulator:

    1. Click and hold down on the lock icon at the bottom of your emulator screen
    2. Drag the mouse up to the top of the screen and release the click