如何启用新的Andr​​oid Multidex支持库multidexing [英] How to enable multidexing with the new Android Multidex support library

查看:200
本文介绍了如何启用新的Andr​​oid Multidex支持库multidexing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用新的Multidex支持库破解方法限制我的应用程序之一。

I want to use the new Multidex support library to break the method limit for one of my apps.

使用Android的棒棒糖谷歌推出了multidex支持库,可以很容易地multidex。

With Android Lollipop Google introduced a multidex support library that makes it easy to multidex.

需要哪些步骤来使用这个库,并与multidex支持建立我的应用程序?

What steps are needed to use this library and to build my app with multidex support?

推荐答案

自2014年12月3日,编译工具 1.0.0-RC1 被释放。现在,所有你需要做的是在你的应用程序类中重写这样的:

Since December 3rd, 2014, build tools 1.0.0-rc1 was released. Now, all you need to do is override this in your Application class:

public class YouApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}

和修改 build.gradle 像这样:

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14 //lower than 14 doesn't support multidex
             targetSdkVersion 22

             // Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

有关详细信息,这是一个很好的指导。

这篇关于如何启用新的Andr​​oid Multidex支持库multidexing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆