MainDexWrapper

Introduction: easy ways to put classes in main dex.
More: Author   ReportBugs   
Tags:

Introduction

Easy way to put classes in main dex.

Usage

  • One of the ways is similar to official realization:
multiDexKeepProguard file('./maindex-rules.pro')
  • Another way is similar to @Keepannotations in proguard.

How to use

build.gradle

in root-build.gradle

buildscript {
    repositories {
        maven {
            url 'https://dl.bintray.com/wangyuwei/maven'
        }
    }
    dependencies {
        classpath 'me.wangyuwei:maindexwrapper-plugin:1.0.1'
    }
}

allprojects {
    repositories {
        maven {
            url 'https://dl.bintray.com/wangyuwei/maven'
        }
    }
}
in lib-build.gradle

apply plugin: 'me.wangyuwei.maindexwrapper'

mainDexWrapper {
    enable true
    keepFile file('./maindex-rules.pro')
}

compile 'me.wangyuwei:maindexwrapper-annotations:1.0.0'

demo

// 1、add @KeepMainDex
package me.wangyuwei.maindexwrapper.demo;

import me.wangyuwei.maindexwrapper.annotations.KeepMainDex;

@KeepMainDex
public class Demo {

    public class InnerClass {

    }

}
// 2、add keep rules in a file.

#-keep class me.wangyuwei.maindexwrapper.demo.Demo {*;}
Android 开发经验分享
随手点击下面广告支持本站吧
 
Android 开发经验分享