Click here to Skip to main content
15,883,705 members
Articles / Mobile Apps / Android
Article

How to Develop and Evaluate 64-bit Android Apps on Intel® x86 Platforms

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Jun 2015CPOL7 min read 8.6K   1  
This article will introduce Android on Intel® 64-bit architecture and discuss its unique compatibilities, including technical details, performance gains, problem statements, and available solutions for Android on Intel® Atom™ processor-based platforms.

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

Nowadays more and more mobile end-user devices are powered by 64-bit architecture. Using 64-bit Android* is a great way to gain access to the market. This article will introduce Android on Intel® 64-bit architecture and discuss its unique compatibilities, including technical details, performance gains, problem statements, and available solutions for Android on Intel® Atom™ processor-based platforms.

Intel continually introduces new, cutting-edge features into its 64-bit processors. Developers who want to take advantage of Intel® Advanced Encryption Standard New Instructions (Intel® AES-NI), and other innovations only need to compile their applications in 64-bit mode. Intel is working to optimize Android for 64-bit architectures and create SDKs that expose CPU functionality to higher level developers.

With Google’s recent release of its x86 64-bit Android 5.0 emulator image, developers can create 64-bit apps for Intel Atom processor-based devices.

Android 32-bit vs 64-bit

Many 64-bit platforms today, including Solaris, AIX*, HP-UX*, Linux*, OS X*, BSD, and IBM z/OS*, use an LP64 model. Since Android is based on the Linux kernel, Android 64-bit platforms also use the LP64 model [1]. The data type is shown in Figure 1.

Image 1

Figure 1: Different data type sizes on LP32 and LP64 Models

Intel 64-bit CPUs have a 32-bit compatibility mode. While 32-bit applications will run on 64-bit processors, compiling with a 64-bit optimizing compiler allows them to take advantage of the architectural benefits of a 64-bit environment.

How to build Android applications for 64-bit

For NDK-based Android applications, you need to build your native libraries to support 64-bit systems. You can do this by performing these steps:

  1. Download and install the right NDK version.
    You can get it from the official website [2] or build it from the AOSP yourself.
    [Note: There are two versions of the NDK for 32- and 64-bit systems starting with NDK R10.]
    For both Windows* and Linux systems, you need to decompress the NDK file and set the right path in the system PATH environment.

  2. Build your libraries to support 64-bit systems.
    Remember to use ABI x86_64 to build your project, using the "ndk-build APP_ABI=x86_64" command. This is the best way to build native libraries for 64-bit Android system on x86 platforms. For other platforms you need to set the APP_ABI to "arm64-v8a" or "mips64". Or you can add the line "APP_ABI = x86_64" to the Application.mk and use the "ndk-build" command directly.
    In most cases, the above command will work well, but sometimes errors will occur. You should correct your native code based on the error information.

  3. Rebuild the whole project to get the new application.
    Now you can install your newly created application and test it on an emulator or on the targeted devices.

How to run 64-bit apps on emulators

If you don’t have any full 64-bit supported devices, you can test your applications in an emulator. Luckily, Android Dev announced the availability of the Android L 64-bit emulator for Intel x86 architecture [3]. You can download and install the 64-bit system image for the Intel Atom processor using the Android SDK Manager. As Figure 2 shows, in the Android SDK Manager you can choose the "Intel x86 Atom_64 System Image" under Android 5.0 (API 21) and install it.

Image 2

Figure 2: "Intel® x86 Atom_64 System Image" checkbox in Android* SDK Manager

Create a new Android virtual device (AVD) based on Intel Atom processor 64-bit system image and open the AVD Manager in SDK Manager or ADT. Then click ‘create’ and fill the fields as shown in Figure 3. Now the 64-bit AVD emulator is ready to run.

Image 3

Figure 3: Create an x64 image in AVD

Follow these steps to run the 64-bit application on the emulator:

  • Edit ./jni/application.mk to APP_ABI := x86_64
  • Compile your native files
  • Run as an Android application on AVD

Image 4

Figure 4: An app named "x86_64 Hello-JNI", running on x64 AVD

Performance on 64-bit x86 Android platform

Based on our testing, application performance is faster on the 64-bit systems. We ran an encryption demo on a 64-bit IA device, codenamed Bay Trail. This encryption demo benefits from both the latest version of Android and Intel AES-NI. Figure 5 shows the results of encrypting a 312M mp4 file. Without the I/O time, the total time is 1.56s on a 32-bit Android 5.0 system, while it ran in 1.49s on 64-bit Android 5.0 system, a performance increase of 5% [4].

Image 5

Figure 5: Time for encrypting mp4 via Intel® AES-NI

Detailed test results are shown in the following table.

Table 1: Detailed test results of running encryption app

Total Time(+SD R/W)
(seconds)

Encryption Time(-SD R/W)
(seconds)

Android* 5.0
64-bit

Android 5.0
32-bit

Android 5.0
64-bit

Android 5.0
32-bit

7.046

7.379

1.498

1.649

7.152

7.27

1.49

1.529

7.011

7.368

1.529

1.57

7.151

7.196

1.487

1.522

7.182

7.282

1.468

1.548

7.1084

7.299

1.4944

1.5636

 

We also built a 64-bit FFMPEG and verified the performance on Android 5.0. The result showed that the average FPS of the 64-bit version is ~7% better than the 32-bit version on the same Bay Trail platform [4].

Image 6

Figure 7: FPS of 1080p MP4 playback through FFMPEG on 64-bit Android*

Here are two more examples that show the performance benefit of 64-bit Android on Intel platforms. The performance benchmarks for several ISV’s software in China shows 7-8% [4] performance gain by using 64-bit compared to 32-bit.

For an ISV’s multimedia decoding application:

This benchmark shows that, in general, playback performance of all formats (3gp, avi, flv, mkv, mov, mp4, rmvb, wmv) increased by ~20% (performance gain of using 64-bit compared to 32-bit) [4].

Image 7

Figure 8: FPS of the multimedia decoding app on 64-bit Android*

For an ISV’s Voice Recognition application:

the Voice Combination Engine enabled for 64-bit Android shows a performance increase of ~40% on 64-bit + ART (~10% performance gain using 64-bit compared to 32-bit) [4].

Image 8

Figure 9: Voice combination engine initialization time on 64-bit Android*

We analyzed the modules of this TTS demo on both 64-bit and 32-bit Android, including get token cost, sty cpy cost, stream cost, and getline cost: (ms).

Image 9

Figure 10: TTS key modules cost on 64-bit Android*

The results show the benefit of 64-bit appliction, especially on the memory I/O and stream operation.

Summary

Android L with 64-bit technologies for Intel Atom processor-based platforms can help developers to optimize their applications now. Building Android applications for 64-bit is just as easy as building traditional 32-bit Android applications. You can now use the official Android 64-bit emulator to run and debug 64-bit apps. To test the performance of 64-bit x86 Android platforms, we rebuilt several open source projects to 64-bit and had several top ISVs in PRC build 64-bit versions of their apps. The performance benchmarks show 7-8% (or even 20% on one special case) performance gains using 64-bit compared to 32-bit.

Related Articles

64-Bit Android OS:
https://software.intel.com/en-us/android/articles/64-bit-android-os

Understanding x86 vs ARM Memory Alignment on Android:
https://software.intel.com/en-us/blogs/2011/08/18/understanding-x86-vs-arm-memory-alignment-on-android

Reference

[1] http://en.wikipedia.org/wiki/64-bit_computing
[2] http://developer.Android.com/tools/sdk/ndk/index.html
[3] https://plus.google.com/+AndroidDevelopers/posts/XG1WmNDMe8H
[4] Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark* and MobileMark*, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products. Configurations: [Asus T100 (CPU-Intel Atom Baytrail T Z3740, Memory-2G, SSD), benchmark test, by Zhang Li& Zhou Zhen]. For more information go to http://www.intel.com/performance

About the Authors

Zhen Zhou earned an MSc degree in software engineering from Shanghai Jiaotong University. He joined Intel in 2011 as an application engineer in the Developer Relations Division Mobile Enabling Team. He works with internal stakeholders and external ISVs, SPs, and carriers in the new usage model initiative and prototype development on the Intel Atom processor, traditional Intel architecture, and embedded Intel architecture platforms.

Zhang Li is an application engineer in the Intel Software and Solutions Group (SSG), Developer Relations Division, Mobile Enterprise Enabling team. He focuses on application enabling on Android.

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

 
-- There are no messages in this forum --