easy ways to put classes in main dex.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
annotations
app
buildsrc
gradle/wrapper
.gitignore
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

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