Building cross platform apps can be a huge savings for your company you are a startup especially because you can hire only one developers for entire mobile suite of applications.
You can build native C++ apps for Android and Windows devices, and share code in libraries built for iOS, Android, and Windows, by using Visual C++ for Cross-Platform Mobile Development. This is an option available in Visual Studio 2015 that installs the SDKs and tools you need for cross-platform development of shared libraries and native apps. When it’s installed, you can use Visual C++ to create code that runs on iOS and Android devices and platforms, in addition to Windows, Windows Phone, and Xbox.
Writing code for multiple platforms can be frustrating. The primary development languages and tools for iOS, Android, and Windows are different on each platform. However, all platforms support writing code in C++. This is the common denominator that you can use to enable reuse of core code across platforms. Native code written in C++ can be both more performant and resistant to reverse engineering. Code reuse can save both time and effort when creating apps for multiple platforms.
You can use Visual Studio to build shared libraries of standard C++ code for Classic Windows applications, Universal Windows apps, iOS, and Android platforms. You can build native apps for Windows and Android platforms using only Visual C++ and third-party tools integrated into Visual Studio. If you have a Mac computer, you can use Visual Studio to create and debug C++ code for iOS apps that are built and deployed on your Mac.
For installation requirements, see Visual Studio 2015 System Requirements.
To build apps for specific device platforms, there are a few additional requirements:
- The Visual Studio Emulator for Android and Windows Phone emulators require a computer that can run Hyper-V. For more information, see the emulator’s system requirements.
- The x86 Android emulators that come with the Android SDK work best on computers that can run the Intel HAXM driver. This driver requires an Intel x64 processor with VT-x and Execute Disable Bit support. For more information, see Installation Instructions for Intel® Hardware Accelerated Execution Manager – Microsoft Windows.
- Building apps for iOS requires an iOS Developer Program account and a Mac computer that can run Xcode 6.
Visual C++ for Cross-Platform Mobile Development is an optional component included in Visual Studio 2015. To get Visual Studio, go to the Visual Studio 2015 Downloads page and download Visual Studio 2015.
The installer for Visual Studio 2015 includes an option to support cross-platform mobile development. This includes the option to install Visual C++ Mobile Development and the following common tools and software development kits. Most of these options are open-source software required for cross-platform support.
- Android Native Development Kit (R10E, 32bits) is required for the Android build process.
- Android SDK, Apache Ant, and Java SE Development Kit are required for the Android build process.
- Microsoft Visual Studio Emulator for Android is a fast, capable emulator for Android development.
For detailed installation instructions, see Install Visual C++ for Cross-Platform Mobile Development.
To build code for iOS, you need to set up and configure a remote build agent on your Mac and connect to it in Visual Studio. For detailed installation and configuration instructions, see Install And Configure Tools to Build using iOS.
You can use Visual C++ for Cross-Platform Mobile Development to create, build, run and debug a complete Android app using C++. Visual Studio includes a template for an Android Native Activity project that can help you get started.
In this tutorial, you’ll first create a new project and then build and run the default app.
Before you can create a new project, make sure that you’ve met all system requirements and installed the Visual C++ for Cross-Platform Mobile Development for Visual Studio. For more information, see Install Visual C++ for Cross-Platform Mobile Development.
Take a look at the video to build cross platform apps
To create a new project
Open Visual Studio. On the menu bar, choose File, New, Project.
In the New Project dialog box, under Templates, choose Visual C++, Cross Platform, and then choose the Native-Activity Application (Android) template.
Give the app a name like MyAndroidApp, and then choose OK.
The new Android Native Activity app solution includes two projects:
- MyAndroidApp.NativeActivity contains the references and glue code for your app to run as a Native Activity on Android. The implementation of the entry points from the glue code are in main.cpp. Precompiled headers are in pch.h. Your app project is compiled into a shared library (.so) file which is picked up by the Packaging project.
- MyAndroidApp.Packaging creates the packaging (.apk) file for deployment on an Android device or emulator. This contains the resources and AndroidManifest.xml file where you set manifest properties. It also contains the build.xml file that controls the Ant build process. It’s set as the startup project by default, so that it can be deployed and run directly from Visual Studio.
Build and run the app generated by the template to verify your installation and setup. By default, the template sets the solution configuration to Debug and the solution platform to x86 to run the app on the Microsoft Visual Studio Emulator for Android. If you prefer to test your app on another target, load the target emulator or connect the device to your computer.
On the menu bar, choose Build, Build Solution.
The Output window displays the output of the build process for the two projects in the solution.
Choose one of the VS Emulator profiles as your deployment target.
If you have installed other emulators or connected an Android device, you can choose them in the deployment target dropdown list.
Press F5 to start debugging, or Shift+F5 to start without debugging.
Here’s what the default app looks like in the Visual Studio Emulator for Android.
Visual Studio starts the emulator, which takes a few seconds to load and deploy your code. Once your app has started, you can set breakpoints and use the debugger to step through code, examine locals, and watch values.
Source - Outdated.
Edited by Sadolock, 16 April 2016 - 04:43 AM.