All Projects → BobbleKeyboard → Dexter

BobbleKeyboard / Dexter

Licence: other
Manage multidexing using simple annotations and gradle tasks.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Dexter

Shortbread
Android library that creates app shortcuts from annotations
Stars: ✭ 1,803 (+4297.56%)
Mutual labels:  gradle-plugin, annotation-processor
poetimizely
Generate Kotlin type safe accessors for Optimizely experiments and features
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin
gradle-localization-plugin
Gradle plugin for automating the download process of localization files.
Stars: ✭ 19 (-53.66%)
Mutual labels:  gradle-plugin
KotlinCompilerPluginExample
This is an example project that shows how to create a Kotlin Compiler Plugin. The plugin will print "Hello from" and the name of the file that is being compiled, as a compiler warning to the terminal log.
Stars: ✭ 43 (+4.88%)
Mutual labels:  gradle-plugin
kotest-gradle-plugin
A gradle plugin for Kotest
Stars: ✭ 18 (-56.1%)
Mutual labels:  gradle-plugin
simple-annotation-processor
Simple annotation processor example. Inspired by the idea of "How ButterKnife works?"
Stars: ✭ 54 (+31.71%)
Mutual labels:  annotation-processor
smartstruct
Dart Code Generator for generating mapper classes
Stars: ✭ 20 (-51.22%)
Mutual labels:  annotation-processor
RocketXPlugin
🔥🔥 android 端编译加速插件🚀 自动识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
Stars: ✭ 408 (+895.12%)
Mutual labels:  gradle-plugin
sonatype-publish-plugin
Gradle Plugin for publishing artifacts to Sonatype and Nexus
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin
gradle-helm-plugin
A Gradle plugin for building, publishing and managing Helm charts.
Stars: ✭ 42 (+2.44%)
Mutual labels:  gradle-plugin
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (-58.54%)
Mutual labels:  gradle-plugin
gradle-build-info-plugin
Gradle plugin to include build information such as Git commit ID to your JAR. It can be used to show Git commit information with Spring Boot Actuator.
Stars: ✭ 33 (-19.51%)
Mutual labels:  gradle-plugin
gradle-izpack-plugin
Gradle plugin that provides support for packaging applications for the Java platform via IzPack.
Stars: ✭ 60 (+46.34%)
Mutual labels:  gradle-plugin
RapidORM
Quick solutions for Android ORM
Stars: ✭ 24 (-41.46%)
Mutual labels:  annotation-processor
AndroidResourceTools
Android resource rename plugin.
Stars: ✭ 41 (+0%)
Mutual labels:  gradle-plugin
removeRes
一键移除Android项目中没有使用到的资源文件和Xml元素声明
Stars: ✭ 16 (-60.98%)
Mutual labels:  gradle-plugin
ManaDrop
A Gradle plugin for Minecraft development
Stars: ✭ 20 (-51.22%)
Mutual labels:  gradle-plugin
SetupBuilder
Gradle plugin for building setups for different platforms.
Stars: ✭ 75 (+82.93%)
Mutual labels:  gradle-plugin
therapi-runtime-javadoc
Read Javadoc comments at run time.
Stars: ✭ 50 (+21.95%)
Mutual labels:  annotation-processor
kotlin-cursor
Kotlin Annotation Processor to generate fromCursor and toContentValues of data classes.
Stars: ✭ 34 (-17.07%)
Mutual labels:  annotation-processor

Dexter

Control your .dex demons.

A utility to manage MultiDex reached apps (>64k method counts).

Managing multidex manually is a troublesome task in itself, this issue is commonly known as the "Worst nightmare of Android developers". Multiple Dalvik Executables can hinder your app's performance heavily in form of crashes and ANRs. It usually becomes a necessity to control what classes should end up in the primary dex file (classes.dex).

What Dexter does?

Dexter helps in:
  • Managing the class entries to be registered in Primary Dex file, using annotations.
  • Validating what goes in your Primary Dex. You can have print the list of classes which the dex files contain using a simple task

Prerequisites.

Add the multidex support library into your project, as mentioned here : https://developer.android.com/studio/build/multidex

Add the following lines:

In your project level build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.github.bobblekeyboard.dexter:dexter:1.0.6'
  }
}

Also:

allprojects {
  repositories {
    google()
    jcenter()
    maven { url 'https://www.jitpack.io' }
  }
}

Add the validationTask in your build.gradle for the debug apk produced to perform the magic:

apply plugin: 'com.bobble.dexter'

import com.bobble.dexter.DexterDefaultTask
import com.bobble.dexter.core.Dexter
import com.bobble.dexter.core.Dexter.BuildVariant

task validationTask(type:DexterDefaultTask){
    Dexter.configure().setBuildVariant(BuildVariant.DEBUG)
}

In you app's build.gradle add support for annotations:

implementation 'com.github.bobblekeyboard.dexter:dexter-annotations:1.0.6'
annotationProcessor 'com.github.bobblekeyboard.dexter:dexter-processors:1.0.6'

Usage.

Registering classes in Primary Dex

Annotate the classes you want to keep in your primary dex, with @PrimaryDex annotation and Dexter will create the multidex.keep file(if not already present) and will also register the annotated classes.

For example, Here we are adding the InitClass.java to primary dex:

@PrimaryDex
public class InitClass {

}

You can also customize the annotations by mentioning extra dependencies you may want to keep in your primary dex as shown in following annotations:

@PrimaryDex(extras = {"android/support/v7/app/AppCompatActivity", "android/os/Bundle"})

Building the project would automatically register the annotated classes to be indexed in the Primary Dex file:

android/support/v7/app/AppCompatActivity
android/os/Bundle
orp/ardnahcimor/test/InitClass

Validating the Dex Files

For validation, Dexter consists of a gradle plugin which gives you an insight to the list of classes going in your multiple dex files. Configuration is very simple:

Sync your project and run a assembleDebug task of gradle.

Run validation task by ./gradlew validationTask command. You will see the total number of class defs, strings and type IDs read in your different Dex files:

alt text

Now go to your project root directory and app/build/outputs you will see a directory created by name of dexter. Here you can find a text file by name of DexClasses of classes.dex which corresponds to your primary dex. If you open this you can see the list of classes in your primary dex and you can validate if any class has entered your primary dex or not.

alt text

You can also see the rest dex Files and there respective text files. You can open the remaining text files to have an insight in the classes entering in them.

Configure for a custom apk path

task validationTask(type:DexterDefaultTask){
  Dexter.configure().setApkPath("/Users/amanjeetsingh150/Desktop/app-debug.apk")
}

Configure for release build

task validationTask(type:DexterDefaultTask){
    Dexter.configure().setBuildVariant(BuildVariant.RELEASE)
}

You can see the output in dexter folder as:

screen shot 2018-07-08 at 1 30 15 am

Show some ❤️ by starring the repo. Dexter is open for contributions. You are free to open issues and PRs.

TODOs

  1. Adding the Dexter Task in the gradle task graph
  2. More customizations for the arguments of Primary Dex annotation
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].