Click here to Skip to main content
15,886,030 members
Articles / Mobile Apps / Android
Article

How to develop Native Android* Apps with Intel® INDE 2015 Visual Studio* IDE Integration?

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
20 Jan 2015CPOL4 min read 19.7K   9   1
This tutorial will guide you through writing a native “Hello World” Android* app in Visual Studio* through the IDE Integration feature of Intel® INDE 2015.

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Intel® Developer Zone offers tools and how-to information for cross-platform app development, platform and technology information, code samples, and peer expertise to help developers innovate and succeed. Join our communities for Android, Internet of Things, Intel® RealSense™ Technology, and Windows to download tools, access dev kits, share ideas with like-minded developers, and participate in hackathon’s, contests, roadshows, and local events.

Introduction

This tutorial will guide you through writing a native "Hello World" Android* app in Visual Studio* through the IDE Integration feature of Intel® INDE 2015.

About Intel® INDE

Intel® Integrated Native Developer Experience (Intel® INDE) is a productivity suite of C++ and Java tools and libraries that speed up the development of mobile and PC applications through code reuse for performance sensitive native code and integrated workflow support. Intel INDE enables creation of Windows applications on Intel® Architecture and Android applications on ARM and Intel® Architecture. Developers have the freedom to use Intel INDE within the IDE they prefer, including Microsoft Visual Studio*, Google Android Studio*, and Eclipse*. Intel® INDE also provides developers access to advanced platform capabilities like media acceleration, context sensing, OpenCL™ 2.0, and threading libraries, with a selection of compilers, analyzers and debugging tools. Intel® INDE is available in three editions: Starter, Professional and Ultimate. For additional information, view the Intel INDE announcement blog in the Intel® Developer Zone.

About Visual Studio* Integration in Intel® INDE 2015

Intel® INDE 2015 has integrated the vs-android plug-in that is available for Visual Studio* with a special template called "Android X86 Native Project" in Visual C++. INDE 2015 also comes with Debugger Extension for vs-android to help debug the apps. Let us see how to build and deploy a sample native app through this feature.

Pre-requisites

Microsoft Visual Studio* 2012 or 2013 (Professional or Ultimate Editions). Express Editions are not supported.

32 bit version of JDK 7 or above

INDE 2015 Setup

Download Intel® INDE 2015 and start the installation. IDE Integration is available on all the editions of the product. Choose your preferred edition to install and then the screen to your choice of IDE Integration would open up. Select Microsoft Visual Studio* development environment and proceed through the rest of the installation.

Image 1

This will download and install all the necessary tools including Android* SDK, NDK, ANT, ADT plug-ins, vs-android etc.

Creating Your First Native Android* App with INDE 2015

Open Visual Studio* and click FILE -> New -> Project.

New Project Wizard opens up. Under Installed -> Visual C++ -> Store Apps -> Android, you will see the "Android X86 Native Project" template. Rename your project to "Hello World"

Image 2

Intel X86 Native Development Experience Android* Project Wizard opens up which allows you to choose your Project Settings. Choose the same API settings that is set in the emulator or your target device.

Image 3

Choose the defaults in the next page "Activity Settings" and finish.

Now you will see the solution file built in Visual Studio*.

Image 4

Right Click on the "Hello World1" solution file and click Properties. The important ones are already highlighted. Choose the right API level and it should match with the emulator you are going to run. You have an option to choose an ARM target from the Target Architecture. X86 Architecture is selected by default. Platform Toolset is selected as x86-4.6 which points to GCC. You can also choose ICC. Image 5

Let us quickly review some important files here on the Solution Explorer.

Jni/NativeCode.cpp has the native C++ code which can access all the native libraries and headers.

Image 6

Open res/layout/activity_main.xml from the Solution Explorer. This file defines the UI lay out of your app. Note that there is no designer view for this yet.

Image 7

Open src/MainActivity.java from the Solution Explorer. This file defines the event handlers for your app and calls the native method from here. For instance, the method "getStringFromNative()" is the interface call to the function defined in jni/NativeCode.cpp.

Image 8

Before you build and deploy this sample, you must start the emulator. For this, go to <inde_install_directory>\INDE\IDEintegration\SDK and start AVD Manager.exe. Start Intel_Nexus_7_x86 emulator that comes by default with this IDE Integration. Make sure that the API level is the same as what you chose in the Project Wizard in Visual Studio*.

Image 9

 

Now to build and deploy, choose BUILD -> Build Solution from Visual Studio*. After the build is successful, choose BUILD -> Deploy Solution. You should see HelloWorld app installed in the emulator.

Image 10

Click "HelloWorld" app and you should see your first app at work.

Image 11

Congratulations on your first milestone!

Troubleshooting tips

  • To speed up your emulator, install Intel® HAXM. Note that you need to turn ON Intel® VT in your BIOS and uninstall Hyper-V if it is installed on your machine.
  • Make sure JAVA_HOME is set to the latest 32-bit JDK that you have installed.
  • You may see this – "Error occurred during initialization of VM, Could not reserve enough space for object heap, Could not create the Java virtual machine". The fix will be to increase the MAX heap size by adding –Xmx512M (it could be any big number) to the environment variable _JAVA_OPTIONS

More troubleshooting tips can be added if you try and comment on this article.

For additional support, visit INDE Support page.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
Intel is inside more and more Android devices, and we have tools and resources to make your app development faster and easier.


Comments and Discussions

 
QuestionVery interesting thing Pin
zhang_200620-Jan-15 21:39
zhang_200620-Jan-15 21:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.