Snippets

Victor Apoyan How To: Rename Package Name inside .jar in Android

Created by Victor Apoyan
buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
        classpath 'com.android.tools.build:gradle:2.0.0'
    }
}

apply plugin: 'com.github.johnrengelman.shadow'

task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
    
}

shadowJar {
    // Filtering shadow jar contents by file pattern.
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE*'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/maven/com.fasterxml.jackson.core/jackson-core/**'

    // Relocating dependencies.
    relocate 'com.google.gson', 'com.viktor.google.gson'
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.