yWorks / yGuard

The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts

Home Page:https://yworks.github.io/yGuard/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to setup using Gradle

akshit0201 opened this issue · comments

I'm following this guide and I'm getting this error:

   > Could not find com.yworks:yguard:2.9.x.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/yworks/yguard/2.9.x/yguard-2.9.x.pom
       - https://repo.maven.apache.org/maven2/com/yworks/yguard/2.9.x/yguard-2.9.x.pom
     Required by:
         project :

Here is my build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.0"
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.yworks:yguard:2.9.x'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }


}
task yguard {
    group 'yGuard'
    description 'Obfuscates and shrinks the java archive.'

    doLast {
        ant.taskdef(
                name: 'yguard',
                classname: 'com.yworks.yguard.YGuardTask',
                classpath: sourceSets.main.runtimeClasspath.asPath
        )

        ant.yguard {
            // see the yGuard task documentation for information about the yGuard element
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

@akshit0201 the guide is a bit outdated.
Use:

classpath 'com.yworks:yguard:3.0.0' and you should be fine.