Next-gen Dex Compiler Preview, Developer Preview 5 of Android Things Released

D8 is available for preview starting with Android Studio 3.0 Beta. Android Things Developer Preview 5 (DP5) moves to Android O codebase.

Share online:

Android Studio Code Editor

The next-generation Dex compiler (D8) available in preview as part of Android Studio 3.0 Beta release, compiles faster and outputs smaller .dex files, while having better app runtime performance.

For those new to Android development, "Dex compilation, is a key step in building an APK, as it transform ".class bytecode into .dex bytecode" for Android Runtime or Dalvik (used in older Android versions)." Though, it mostly works under the hood, but "it directly impacts an app's build time, .dex file size, and runtime performance."

To try it, by downloading the Android Studio 3.0 Beta.

Google says it'll preview D8 with Android Studio 3.0, to address any critical bug reported by the community over the next several months. Adding, it says, D8 will be set as the default dex compiler in Android Studio 3.1, once it's out of preview, and at that time, "the DX compiler will officially be put in maintenance mode."

Beyond D8, the company is also working on open source project called "R8," a Proguard replacement for whole program minification and optimization, however it hasn't yet been integrated with Android Gradle plugin.

In addition, Google says, the desugaring step will move to a later stage in the pipeline as of part of D8, over next few months. This change means that any bytecode reading or rewriting tools will run before desugar step," explains Google, adding, thus, "it will further reduce overall build time and produce more optimized code."

dex file size dx vs d8
Dex file size DX vs D8

"The desugaring was announced in April with Java 8, and currently it happens immediately after Java compilation (javac) and before any bytecode reading or rewriting tools are run," google writes.

If you develop .class bytecode reading or rewriting tools for Android, you will need to make sure they can handle the Java 8 bytecode format so they can continue to work properly when we move desugaring into D8.

Android Things being updated to Android O, with significant changes made to the platform with Developer Preview 5 (DP5) releasing to developers, and is now based on O (previously based on Android N). This means, all future Android Things apps should now target API 26 to work correctly on O with support libraries.

"Android Things is Google's platform to enable Android Developers to create Internet of Things (IoT) devices, and seamlessly scale from prototype to production."

Android O is currently under Developer Preview for phones and tablets, with moving to O codebase, DP5 now adds:

  • support for new NXP SprIoT i.MX6UL design
  • Intel Edison and Joule platforms moving to legacy support, and willn't receive any latest platform updates, however, developers can still access DP4.1 system images from Android Things Console.
  • new API features from Android as well as specific features for Android Things.
  • developers using UserDriver APIs, will need to add new permissions to AndroidManifest.xml.
  • DP5 also now supports OpenGL ES 2.0 and WebView on Raspberry Pi 3.
  • implemented dynamic pin muxing for Raspberry Pi 3, with pins being configured at runtime depending on what features are being used.

Additionally, Android Things Console, now provides an ability to support over-the-air updates (OTA) to Android Things devices. Also, a number of UX improvements are made to console improving usability and functionality.

The team notes, when Android Things exit Developer Preview, it'll "differentiate between hardware platforms targeted for prototyping-only and hardware reference designs that can scale to production."

Those interested in Android Things can browse and import a wide range of samples directly in Android Studio, by going to "File, New, Import Samples, and search for Things available." The samples demonstrating how to interact with buttons, sensors, LEDs, and displays, as well as implementing Google Assistant and TensorFlow.

For getting started with DP5, download and update existing devices with system images from Android Things Console. The DP5 update, when released, "will not be pushed automatically to devices without intervention," team writes."devs will need to update application for DP5, then create a new update and push it via the console yourself."