Home > other >  Could not find semver4j-0.16.4-nodeps.jar (com.github.gundy:semver4j:0.16.4). - Android Studio Java
Could not find semver4j-0.16.4-nodeps.jar (com.github.gundy:semver4j:0.16.4). - Android Studio Java

Time:10-12

I am having the problem that you have stated, I cannot compile.

A problem occurred configuring root project 'PingTv - Copy'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find semver4j-0.16.4-nodeps.jar (com.github.gundy:semver4j:0.16.4).
     Searched in the following locations:
         https://jitpack.io/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4-nodeps.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

As a solution, I tried the solution in this question, but it didn't work for me. I would be glad if you help.

My Gradle project file is as I added below:

// Top-level build file where you can add configuration options common
to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        maven {
            url "https://jitpack.io"
        }
        maven {
            url "http://oss.sonatype.org/content/repositories/snapshots"
            allowInsecureProtocol = true
        }
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven {
            url "https://maven.google.com"
        }
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath 'com.google.gms:google-services:4.3.14'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    configurations {
        all {
            exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
        }
    }
    repositories {
        google()
        mavenCentral()

        maven {
            url 'https://jitpack.io'
        }
        maven {
            url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j' //-> Add
        }

        maven {
            url "https://dl.appnext.com/"
        }
        maven {
            url 'https://startappdev.bintray.com/maven'
        }
        maven {
            url "http://oss.sonatype.org/content/repositories/snapshots"
            allowInsecureProtocol = true
        }
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven {
            url "https://maven.google.com"
        }
        flatDir {
            dirs 'libs'
        }
    }
}

CodePudding user response:

Attempting to visit the JitPack link directly in the browser returns this result:

Artifact available on Maven Central

And after further research (by searching for com.github.gundy on the Maven Central Repository Search website), there appears to be a valid artifact for com.github.gundy:semver4j:0.16.4 on Maven Central.

You should thus only need to include the mavenCentral() repository in your build.gradle:

buildscript { // Or wherever you're using the semver4j dependency
  // ...
  repositories {
    mavenCentral()
    // Other repositories go here...
  }
}

Or in this case, to fix the order of your repositories such that the mavenCentral() repository takes precedence over the JitPack repository:

repositories {
  mavenCentral() // This should go BEFORE JitPack
  maven { url "https://jitpack.io" }
}

As a side-note, there is also no need to declare the Google Maven repository if you already have google() included:

repositories {
  google() // OK
  maven {
    url "https://maven.google.com" // No need
  }
}
  • Related