Skip to content

JeasonWong/MainDexWrapper

Repository files navigation

MainDexWrapper

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 @Keep annotations 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 {*;}

About

easy ways to put classes in main dex.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages