Giter Club home page Giter Club logo

android-easy-multidex's Introduction

DEPRECATED

You should now rely on the official way of doing muti-dexing.

android-easy-multidex

Sample project illustrating how to overcome the 65536 methods dex limitation. Based on the awesome article of @alex_lipov.

Easy setup

To be able to overcome the 65536 methods dex limitation, simply do the following steps :

  • Add to your android closure inside your build.gradle :
dexOptions {
    preDexLibraries = false
}
  • Add the following closure to your build.gradle :
afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = []
        }
        dx.additionalParameters += '--multi-dex'
        dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString()
    }
}
  • Create the file multidex.keep in the same folder than the build.gradle with the following content :
android/support/multidex/BuildConfig.class
android/support/multidex/MultiDex$V14.class
android/support/multidex/MultiDex$V19.class
android/support/multidex/MultiDex$V4.class
android/support/multidex/MultiDex.class
android/support/multidex/MultiDexApplication.class
android/support/multidex/MultiDexExtractor$1.class
android/support/multidex/MultiDexExtractor.class
android/support/multidex/ZipUtil$CentralDirectory.class
android/support/multidex/ZipUtil.class
  • Add inside your libs folder the android-support-multidex.jar located here : ANDROID_HOME/extras/android/support/multidex/library/libs
  • If you do not subclassing the Application class, add in your AndroidManifest.xml, into the application element, the attribut android:name="android.support.multidex.MultiDexApplication"
  • If you are actually subclassing the Application class, make it extending the MultiDexApplication class.

Here you are, you do not have to bother anymore with dex limitation on number of methods. Keep in mind that it will only work on ICS (API 14) and above.

Again, please go read this awesome article of @alex_lipov to get the whole explanation.

android-easy-multidex's People

Contributors

vincentbrison avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.