Build the Andriod Environment for C # Development with Visual Studio 2012+xamarin

Source: Internet
Author: User
Tags oracle vm virtualbox vm virtualbox visual studio 2010

Original: Building the ANDRIOD Environment for C # Development with Visual Studio 2012+xamarin

First step: Install Visual Studio:

Visual Studio 2012 (or Visual Studio 2010), because the add-ons for Visual Studio so far only support versions 2010 and 2012, and the installation process is not explained here.

Step Two: Install Xamarin:

1. To http://xamarin.com/download here to register an account, you can download the Xamarin installation package. Such as:

This installation package after the installation can be tested for 30 days, 30 days after the expiry of other methods of renewal, online, you can find.

2.Xamarin installation process, the program will be installed on the default Java, Xamarin, Xamarin Studio, Andriod SDK, Andriod NDK, forgot to say, My computer was installed before the Java, configured the path of the JDK, You do not know can go online to find the method of configuration, online configuration method is quite a lot. After this process is over, you can open your visual Studio and, under the Tools menu, have an option for the Xamarin account as follows:

Click on the Red box option above and a login screen will appear:

Select Xamarin.andriod, select Log in:

Enter the email address and password you used to register when you first downloaded Xamarin, and click Log in to see the following:

Note that the above process should be used in a connected state, if you are already connected to the network but the login screen is always prompt you connect Internet processing ... , your Visual Studio may have a problem with the installation, I have this situation, because it has been resolved, no, so you can understand. If the connection succeeds, the following will appear:

When we get here, most of the work is done, and the rest is to install the Andriod simulator. In fact, at this point you can create a new Andriod project to see the effect.

In fact, you can see after the installation of Xamarin, the template of the new project has more andriod and iOS two options, after the new project APP4, you can try to click the Green Startup button, the following, and prompted you to deploy the error, see this do not panic, this is normal phenomenon.

If you are prompted to generate an error, the error content is:

Error 1 cannot find ' aapt.exe '. Install the Android SDK Build-tools package with the ' C:\Users\Administrator\AppData\Local\Android\android-sdk\ Tools\android.bat ' program. UnitTestApp1

You will have to open the "tools-and Options->xamarin" in your Visual Studio, click Xamarin, and see if your Visual Studio can find your computer's Andriod SDK path and Andriod NDK path. General If you install the Visual Studio 2012 (or version 10) and then install Xamarin, it seems that Visual Studio will automatically recognize your installation path, no changes, change the installation order, I have not tried, the other people on the internet said to be the path!

If your SDK and NDK path configuration is correct, but still will prompt the above error, I suggest you find the SDK path directory under the SDK Manager.exe, run this file, the box options are ticked, all updated, this process is very long, so I hope everyone patience! The Update Log dialog box will appear during the update process until the dialog prompts you to complete the update, the update is complete, or if you break it halfway, your new program will not work.

Completion of the above steps, is not far from success, but also the last step, install the Andriod simulator, this is the final test results of your program display part, so it is quite important.

The third step: Install Andriod simulator, this step everyone has two sets of plans, one is to configure Xamarin with the Android simulator, I checked the relevant information, found that Xamarin's simulator is very slow, running is not smooth, so I chose the second set of options, choose Genymotion, This guy claims to be the king of the Android simulator, after installation, found can also, in line with my requirements, I did not delve into the first program, you are interested can delve into the first set of solutions to try.

1. Download genymotion

https://cloud.genymotion.com/page/customer/login/?next=/, register to download and then install. This will install the Genymotion and Oracle VM VirtualBox at the same time during installation, after installing the Oracle VM VirtualBox, there is a prompt "Oracle VM VirtualBox is installed, do you want to start the program?" ", the check box of his multi-marquee is the default, first remove that tick." Then a different dialog box appears, prompting you to "Genymotion is already installed, do you want to run it?" "This tick is also the default tick, this tick do not remove, click OK, start Genymotion." Because if the previous tick is not removed, genymotion is not able to run, it will be stuck at the beginning of the interface.

First run genymotion will prompt you to enter the username and password, you can choose to remember the password, you do not have to lose. Then you are prompted to add a virtual host:

Click Yes directly, then select the model of the virtual machine you want to add:

Click Next to start downloading the virtual host Image:

Note that the host image you download is in a state that your Visual Studio can recognize, depending on whether the API version type of the image you downloaded can be compatible with your Visual Studio. The version of the image API that you download is already marked when you select the image, and the minimum API version that your Visual Studio can be compatible with is set up under Solution Explorer for your new project, such as:

Select Properties Right-click to set minimum andriod to target, you can set a lower API version.

Set it up and then go back to Genymotion, choose a new virtual machine, click Play, and run the virtual machine.

After running it is this:

Now look at the andriod target device bar in Visual Studio that will have the name of the Andriod analog device you are currently running.

Now click the Green Run button in Visual Studio, run the program APP4, wait a moment, and then look at the Andriod simulation device you just opened, and find that the phone interface is really running the program I created, so far, the entire configuration process is completely over.

The following diagram shows the results of the click-to-run:

The following figure is the result of my click on the simulation interface two times:

Note: During the installation process, I also encountered an issue where the Android emulator could not be started, as shown in the following:

The reason for this error is that your original virtual network card is disabled, and the newly generated virtual network card does not match the actual one you are using. At this time you can have two solutions, the first, put the network card you disabled to enable, and then open the Oracle VM VirtualBox This software, to set up the network card for you to enable the network card. The second option is to set the IP address of your virtual network card to be automatically acquired.

The above sharing experience is based on my personal these days to configure the process to explain, may be some people want to configure the environment to help, but there will be one-sidedness, we still refer to the good, the specific situation or to practice. If there is any mistake hope everyone can contain!

Build the Andriod Environment for C # Development with Visual Studio 2012+xamarin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.