Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue resolving gradle dependency in android studio?

I am trying to add a styled progress bar from https://android-arsenal.com/details/1/1375

There it says:

Add the specific repository to your build file:

repositories {
   maven {
      url "https://jitpack.io"
   }
}

Add the dependency in your build file (do not forget to specify the correct qualifier, usually 'aar'):

dependencies {
   compile 'com.github.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}

Well I did that... build.gradle (Project)

buildscript {
repositories {
    jcenter()
    maven {
      url "https://jitpack.io"
   }

}
  dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'

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

allprojects {
  repositories {
    jcenter()
  }
}

build.gradle (Module): apply plugin: 'com.android.application'

android { compileSdkVersion 21 buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.chaz.simsirl"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:21.0.3'
   compile 'com.github.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}

Then in messages it says: Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find com.akexorcist:Android-RoundCornerProgressBar:1.0.0. Searched in the following locations: https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar Required by: SimsIRL:app:unspecified

like image 819
pxlcrisis Avatar asked Feb 28 '15 07:02

pxlcrisis


People also ask

How do I resolve Gradle dependencies?

Given a required dependency, with a version, Gradle attempts to resolve the dependency by searching for the module the dependency points at. Each repository is inspected in order. Depending on the type of repository, Gradle looks for metadata files describing the module ( .

How do you resolve dependency?

In Java "resolving a dependency" usually refers to a library that you include (and use) in your project. When you're having "resolving issues" it's usually due to missing, incorrect or incompatible version of a library.


1 Answers

You would need to add the jitpack repository in a different place:

allprojects {
  repositories {
    jcenter()
    maven { url "https://jitpack.io" }
  }
}

Then it works

In your first snippet it was added under buildscript and it should be removed from there.

like image 172
metrimer Avatar answered Oct 17 '22 17:10

metrimer