• Solutions
    • Streamroot DNA
    • DNA Complete
    • DNA Enterprise
    • Compass
  • Company
    • About
    • Careers
    • Partners
  • Customer Stories
  • Demo
  • Docs
  • Blog
Request a Trial
    • Streamroot DNA
    • DNA Complete
    • DNA Enterprise
    • Compass
  • Demo
  • Docs
  • Blog
  • Sign In
  • Request a Trial

Reduce Build Size

  1. Streamroot Documentation
  2. Android
  3. Getting started on Android

In this article, we explain how to reduce your APK size once you have embedded our Android SDK to make it as small as possible.

 

Streamroot library: 

Streamroot library is an AAR, which stands for Android ARchive. The goal of our library is to provide all the necessary bindings for our customers to integrate it on all platforms and architectures, which brings some redundancy and size increase.

Streamroot's core library weighs less than 2MB alone, but it uses some large dependencies such as the WebRTC C++ library, which is compiled for different architectures.

 

How to reduce your build size

The solution we recommend is to split the builds per CPU architecture. This technique is referenced by Google in their article Reduce the APK size and the part that interest us is fully documented in Build multiple APKs. Although all the techniques described in the first article can help you lower your APK size, we are only going to cover the CPU split aspects.

Google documentation advices to deliver multiple APKs when dealing with native libraries. The following configuration enables you to do so:

android {
  ...
  splits {

    // Configures multiple APKs based on ABI.
    abi {

      // Enables building multiple APKs per ABI.
      enable true

      // By default all ABIs are included, so use reset() and include to specify that we only
      // want APKs for x86 and x86_64.

      // Resets the list of ABIs that Gradle should create APKs for to none.
      reset()

      // Specifies a list of ABIs that Gradle should create APKs for.
      include "x86", "x86_64"

      // Specifies that we do not want to also generate a universal APK that includes all ABIs.
      universalApk false
    }
  }
}

By targeting only specific CPU architectures, we were able to reduce our demo app size by almost 300%, from 30MB to 12MB.

If you have a need to target mips, mips64, or armeabi CPUs, we strongly encourage you to check the full article, especially under the Configure multiple APKs for ABIs. Also, as this feature of having one APK per CPU architecture is fully supported by the Google Play Store, Google wrote an article called Multiple APK support that might help you go through the publishing of your application while doing so.

 

What's next

We are currently working on reducing the WebRTC library size, to only use Datachannels and PeerConnection modules. This improvement will decrease the SDK significantly.

  • Facebook
  • Twitter
  • LinkedIn
  • Google+
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Return to top

Related articles

  • ExoPlayer
  • Debug tools for Android
  • mpx Player
  • DNA Master Release
  • Debug tools for web

SOLUTIONS


  • STREAMROOT DNA™
  • DNA COMPLETE
  • DNA ENTERPRISE
  • COMPASS

COMPANY


  • ABOUT
  • CAREERS
  • PARTNERS

RESOURCES


  • DEMO
  • DOCUMENTATION
  • CUSTOMER STORIES
  • BLOG
  • FAQ

CONTACT US


  • CONTACT US
Privacy Policy