# Android CPU, Compilers, D8 & R8

DevFeed: [Android CPU, Compilers, D8 & R8](<https://devfeed.tech/articles/android-cpu-compilers-d8-r8-26131.md>)

Original publisher: [Read original article](<https://proandroiddev.com/android-cpu-compilers-d8-r8-a3aa2bfbc109?source=rss-8735065c2497------2>)

Author: Yonatan (Yoni) Levin

Published: 2019-03-18T06:27:24Z

Content type: tutorial

Language: en

Sources: [Stories by Yonatan V. Levin on Medium](<https://devfeed.tech/sources/stories-by-yonatan-v-levin-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [R8](<https://devfeed.tech/topics/r8.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Arm](<https://devfeed.tech/topics/arm.md>), [x86](<https://devfeed.tech/topics/x86.md>), [Qualcomm](<https://devfeed.tech/topics/qualcomm.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-architecture](<https://devfeed.tech/tags/android-architecture.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [arm](<https://devfeed.tech/tags/arm.md>), [bytecode](<https://devfeed.tech/tags/bytecode.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [development](<https://devfeed.tech/tags/development.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [jit](<https://devfeed.tech/tags/jit.md>), [qualcomm](<https://devfeed.tech/tags/qualcomm.md>), [r8](<https://devfeed.tech/tags/r8.md>), [x86](<https://devfeed.tech/tags/x86.md>)

## AI overview

A tutorial introducing Android CPUs, the JVM, bytecode, the Android build system, AOT and JIT compilation, and Google's R8 compiler improvements. It also discusses CPU architectures and the challenges of compiling native code for different devices.

## Source excerpt

Imagine you have an important space mission ahead. You need a spacecraft that won't get you into much trouble on the way. You may opt in a regular YT-1300 freighter. It's popular and you know the basics of its operation. However, you've always dreamed of maneuvering like a pro. You are ready to practice a lot and learn various stuff. Millenium Falcon is what you actually want. But this upgraded spaceship will require that you master it like Han Solo! Lately, I've been inspired by the Google effort to improve compilers, such as the development of R8 or speeding up the Gradle builds. So I guess this is the right time to dig in and talk to you about those improvements. But first, let me guide you through the basics. When you reach the end of this article: You'll know about JVM and its relation to Android. You'll be able to read Bytecode. You'll get an idea of the Android Build System. You'll learn what AOT and JIT stand for and how they are connected to the new R8 compiler. And also a little bit about Star Wars :) So grab a large cup of good coffee, the lightsaber, cookies, and prepare for a read :) CPU & JVM In every device, there is a CPU. It's a tiny thing responsible for every single calculation in your app. In the beginning, the CPU could tackle only with basic math operations such as addition, subtraction, division, and multiplication. Over the years it has evolved into a complex mechanism that can be tailored for specific needs like Image Processing, Audio Decoding with a smart caching mechanism. The most known CPU is Snapdragon by Qualcomm. But there are others. Some of them use the same CPU architecture as Qualcomm, while some don't. And here I say 'Welcome to hell.' If you've ever developed C++/C, you know that your native code should be compiled to every supported CPU architecture: ARM, Arm64, x86, x64, MIPS. As an Android developer, you have to support CPU architectures for all the variety of devices. Basically, this means multiplying your .so files by the