Developing the Android/ios installation package and operating procedures on visual Studio 2013/2015 using C #

Source: Internet
Author: User
Tags android sdk manager

Original: Use C # to develop Android/ios installation packages and procedures on visual Studio 2013/2015

Xamarin Configuration manuals and offline package downloads

Specific operation:

Installation Prerequisites

1, install Visual Studio 2013, the installation process is omitted, I installed here Windows10 + vs2013 with update 4.

2, install the Java SDK, follow the next step installation, omitted here, such as:

3, install the Android SDK: because the online installation of access to Google problems, and slow, the use of the offline installation package, copy the Android SDK to the specified directory

I copy here to C:\Program Files (x86) such as:

4. Install Android NDK: here Copy the Android NDK offline package, such as:

Here you specify the copy to C:\Program Files (x86) such as:

5, install Xamarin, follow the next step-by-step installation.

Environment configuration

1. Configuring the JDK

Open the My Computer Properties-Advanced system settings-environment variables such as:

1) The first "java_home": java_home content is the JDK installation directory. such as the location of the C:\Program Files (x86) \java\jdk1.7.0_60, and no semicolon behind , such as:

2) Second, check the classpath, which is a call to a jar package ...; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar (preceded by a number and semicolon, with a semicolon at the end.) Or can be written as ".; %java_home%\lib ", the same effect. Such as:

3) Third check whether the "path" variable is correct, the path variable is very simple, is the JDK bin directory meaning. %java_home%\bin;

4) If the JDK is installed, the normal cmd input javac must be successful. You will be prompted with the following information

2. hack Xamarin

1) hack android: Copy

Mandroid.exe to%programfiles (x86)%\msbuild\xamarin\android

In the cmd command, switch to%programfiles (x86)%\msbuild\xamarin\android directory and run the following command to register:

Mandroid.exe--activate--activation-name=b4a--activation-phone=b4a--activation-company=b4a--activation-code=b4a --activation-email=b4a

The detailed steps are as follows:

After carriage return

Enter a string of characters after the cursor:

And then enter to complete the registration.

2) Check if registration is successful

Run command: Mandroid.exe--entitlements > "%temp%" \mfa.txt

Run command again: Type "%temp%" \mfa.txt

Note: If a form similar to "Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx monoandroid priority2015-08-26t05:52:36" appears, the registration is successful.

3) Hack IOS: Copy Mtouch.exe to%programfiles (x86)%\msbuild\xamarin\ios

In the cmd command, switch to%programfiles (x86)%\msbuild\xamarin\ios directory and run the following command to register:

Mtouch.exe--activate--activation-name=b4a--activation-phone=b4a--activation-company=b4a--activation-code=b4a-- activation-email=b4a

3. Updating the android SDK

Open SDK Manager , such as:

I am here offline package, version 23.0.5, if found below platform-tools have update, can update


u continue to update these Android x.x.x in the SDK are different versions of the Android system development package, you want to do which version of the development, download which, high version compatible with the low version, that is, you develop an API 10 version of the app, the higher version of the system can also be run. So you should at least have the latest version and a more extensive low version, such as API 8

u Eliminate SDK update when the " Https:// refused "Exception : When updating, the domestic cannot connect the Google server, can use the proxy, freegate on the line

The workaround is to modify the https://to http://
The modification method is: for example, in the Android SDK manager->tools-options ... Options interface,
Check "Force https://... sources to be fetched using http://..."!

If you have any errors, you can add the following lines in the file (C:\Windows\System32\drivers\etc\hosts):

4. Configuring the SDK and NDK path for VS2013

Open the VS2013 "Tools"-"options", such as:

Well, this time you can start developing. Install the Android emulator, you can connect the simulator to debug

Development examples

Open the VS2013 and build a VS2013 Android project, such as:

Ø Click on the Android emulator to configure the simulator, such as:

Point "Create"

New simulator AVD here

Start the emulator, such as:

After startup such as:

After clicking "Launch", click on the following example:

Starting ....

Wait for the start to complete with the following effect:

In VS2013 press F5 to start the Android app, the Android app will be installed in the simulator for the first time, such as:

Simulator Genymotion Installation

Since the emulator provided by the Android SDK is in the big slow, too bad, so have to find a replacement. Virtual box-based genymotion is definitely the best choice and runs very smoothly, but currently only supports Android4.1.1, 4.2.2.

On the official website: a good account, and download the installation of Genymotion, the latest version of the current 1.3.0.

You need to install virtual box on your PC before installation (currently the latest version is 4.3.2), but I found that I installed the virtual box 4.3.2 Genymotion Unable to start, so later replaced by the official recommended 4.2.12, from https:// download.

After the installation is complete:

· Via the "Settings" button: Set up the Android SDK path and tick "when a virtual devices starts, connect it automatically to ADB", "ADB from Android Deve Loper Tools successfully found ".

· Via the "ADD" button

· Add a device and then need to sign in

· If the selected device image is not downloaded, you will need to download the vbox image of a device online, with a typical image size of 200M.

· Add a virtual machine with the wizard prompts, enter a name such as "Lwme Nexus s-4.2.2-with Google apps-api 17-480x800" and wait for the virtual machine to be created.

· Running a virtual machine from the Play button

After the virtual machine is started, the toolbar of VS will list the name of the device and you can select the device to debug the Android application on the Genymotion emulator.

Ø genymotion Frequently asked questions

OpenGL must be supported

1 , there is a "unable to load VirtualBox engine" prompt, then no response.


1, please go to C:\Users\USER\AppData\Local\Genymobile, look for a genymotion notepad txt file. Open will see a bunch of dense, ctrl+f search "found in Settings" a little later, you will see a path, then follow the path above to reinstall.
2, to see if there is a network neighbor installed VBox when the connection established, the default name is generally "VirtualBox host-only Network", to see if this connection is disabled, if disabled, there will be such a hint.
3, look at the system's user name is not Chinese, if it is Chinese to English, uninstall after reinstallation.
4, see if it is installed when the anti-virus software, if opened, quit antivirus software, uninstall after reinstallation.

Visualgdb Debugging Android

1. install visualgdb, crack version

² Mounting Visualgdb-4.2r4-trial.msi

² The VisualGDB.exe under the crack is overwritten with the files in the installation directory, and the installation path defaults to C:\\Program Files\\sysprogs\\visualgdb

2. Download and install VISUALGDB, after the installation is complete, you can see the Android option in the catalog in Visual Studio:


The VBox and VMware two products all support 3D acceleration, but there are no small differences. That is, the support for OpenGL and DirectX is different, VMware does not support OpenGL acceleration only through the CPU simulation, and VBox both can be accelerated through the graphics card. So Ubuntu Compiz effect is not used in VMware, but VBox can, want to experience Compiz, please bypass VMware. Again, DIRECTX,VBOX:DXDIAG,DX7 interface error, DX8,DX9 interface is normal. 3DMark06, the newspaper does not support pixel Shader 2.0. Vmware:dxdiag,dx7-9 interface Normal, 3dmark06, normal, and host difference of more than 100 points. In practical use, some 3D games in VMware are not operational.

Frequently asked questions, if "program" Mono has exited, the return value is 0 (0x0). "And you can try so set

Working principle

The android application is compiled into IL code and then JIT-compiled (dynamically compiled) at startup, and a mono runtime is included when the program is published. iOS compiles the code for ARM directly through AOT compilation (statically compiled)

Xamarin Configuration manuals and offline package downloads

Learning materials: Http://

Developing the Android/ios installation package and operating procedures on visual Studio 2013/2015 using C #

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: 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.