All Projects → artyomd → Injector

artyomd / Injector

Licence: apache-2.0
Gradle plugin for android which makes easier to inject aar libraries into project

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Injector

Auto Manifest
Generates AndroidManifest.xml in simple libraries so that you don't have to
Stars: ✭ 51 (-41.38%)
Mutual labels:  gradle-plugin
Gradle Android Javadoc Plugin
Gradle plugin that generates Java Documentation from an Android Gradle project.
Stars: ✭ 73 (-16.09%)
Mutual labels:  gradle-plugin
Gradle Plugins
Gradle Plugin Collection
Stars: ✭ 84 (-3.45%)
Mutual labels:  gradle-plugin
Gradle S3 Build Cache
An AWS S3 Gradle build cache implementation
Stars: ✭ 54 (-37.93%)
Mutual labels:  gradle-plugin
Gradle Clover Plugin
Gradle plugin for generating a code coverage report using Clover
Stars: ✭ 67 (-22.99%)
Mutual labels:  gradle-plugin
Apkscale
A Gradle plugin to measure the app size impact of Android libraries
Stars: ✭ 76 (-12.64%)
Mutual labels:  gradle-plugin
Enigma
Gradle Plugin - Obfuscator String Encryption (Android/Java)
Stars: ✭ 43 (-50.57%)
Mutual labels:  gradle-plugin
Methodtraceman
用于快速找到高耗时方法,定位解决Android App卡顿问题。通过gradle plugin+ASM实现可配置范围的方法插桩来统计所有方法的耗时,并提供友好的界面展示,支持耗时筛选、线程筛选、方法名筛选等。(A Tool for Discovering High Time-consuming Methods for Android App)
Stars: ✭ 1,258 (+1345.98%)
Mutual labels:  gradle-plugin
Gradle Semantic Build Versioning
Gradle plugin to generate version-numbers and tags using semantic versioning
Stars: ✭ 69 (-20.69%)
Mutual labels:  gradle-plugin
Apiinspect
An api compatibility inspect gradle plugin.(一个Api兼容性检测的Gradle插件)
Stars: ✭ 84 (-3.45%)
Mutual labels:  gradle-plugin
Module Service Manager
Android模块化/组件化通信框架
Stars: ✭ 58 (-33.33%)
Mutual labels:  gradle-plugin
Gradle Gae Plugin
Gradle plugin that provides tasks for uploading, running and managing Google App Engine projects
Stars: ✭ 62 (-28.74%)
Mutual labels:  gradle-plugin
Gradle Android Apk Size Plugin
Gradle plugin that generates CSV files with apk size per output and variant of an apk
Stars: ✭ 79 (-9.2%)
Mutual labels:  gradle-plugin
Licensechecker
Gradle plugin to check that all Open Source Libraries in a project have been attributed
Stars: ✭ 52 (-40.23%)
Mutual labels:  gradle-plugin
Rambuild
A plugin to make builds in gradle run on ram instead of the hard drive
Stars: ✭ 84 (-3.45%)
Mutual labels:  gradle-plugin
Onesignal Gradle Plugin
Use with OneSignal-Android-SDK to help integrate it into your Android Studio or Gradle project. https://onesignal.com
Stars: ✭ 49 (-43.68%)
Mutual labels:  gradle-plugin
Debug Badge
Add badge(version code, version name, etc) for your DEBUG APK.
Stars: ✭ 75 (-13.79%)
Mutual labels:  gradle-plugin
Gradle Buildconfig Plugin
A plugin for generating BuildConstants for any kind of Gradle projects: Java, Kotlin, Groovy, etc. Designed for KTS scripts.
Stars: ✭ 85 (-2.3%)
Mutual labels:  gradle-plugin
Androidanimationexercise
Android 动画各种实现,包括帧动画、补间动画和属性动画的总结分享
Stars: ✭ 1,254 (+1341.38%)
Mutual labels:  gradle-plugin
Gradle Site Plugin
Documents Gradle tasks and plugins registered by your Gradle project
Stars: ✭ 83 (-4.6%)
Mutual labels:  gradle-plugin

Injector

Maven Central Codacy Badge Known Vulnerabilities

Injector is a gradle plugin for android projects which helps to make third-party android libraries downloadable. Injector supports android gradle plugin 3.1.0+. For more information and background of Injector you can read this article.

How it works

Injector plugin extracts all aar files into build/exploded-aar directory then, merges all manifests to your project's manifest, copies all resources into your project's resource directory, generates R.java for aar libraries, compiles them and injects classes into library's class.jar and then creates dex files from jar files.

How to use

Injector consists of two parts: gradle plugin (to create dex files from aar and jar files) and android library (to load dex files)

How to create dex files

Add maven central repository to your project's build script and add injector library to your classpath app.artyomd.injector:injector:{latest-version} . Your build script should look like the following

buildscript {
    repositories {
        google()
	mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'app.artyomd.injector:injector:{latest-version}'
    }
}

After this, you can just apply plugin: 'app.artyomd.injector' in you android library module and use inject configuration to inject other libraries into your project. Injector also provides a configuration closure to exclude libraries with group/name and specify dex file location. Default location of dex file is build/outputs/inject/inject.dex. To generate dex file you must run of the following tasks createInjectDebugDexes or createInjectReleaseDexes

injectConfig{
    enabled = true
	excludeGroups = ["com.foo.*", "bar.foo.*"]
	groups = [
            "X": ["foo.bar.*"]
    ]
    dexLocation = "/outputs/inject/inject.dex"
}

By default, we are excluding android libs such as com.android., android.arch., etc.

With this inject config you will get X.dex and inject.dex files in /outputs/inject/ directory and that dex files will not contain classes which packages are "com.foo.", "bar.foo." and X.dex will only conatn classes which packages are "foo.bar.*".

How to load dex files at runtime

Injector also provides android helper library to inject dex files. Add maven central repository to your project dependencies and add "app.artyomd.injector:injector-android:{latest-version}" in your dependencies

repositories {
        google()
	mavenCentral()
        jcenter()
    }
dependencies {
    implementation "app.artyomd.injector:injector-android:{latest-version}"
}

You can upload dex file to somewhere and then at runtime download and load it or copy dex file to assets folder then at runtime copy the file into internal storage and then load dex file. If your dex files are in the assets dir just use DexUtils.prepareDex to copy dex files into internal storage. Using DexUtils.loadDex you can load a list of dex files into your application at runtime.

Disclaimer

An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism. Likewise, an app may not download executable code (e.g. dex, JAR, .so files) from a source other than Google Play. This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a webview or browser). Source

Be aware that downloading executable code from an application may affect the removal of your application from Google Play.

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].