7

I am using photoview from this library com.github.chrisbanes:PhotoView:1.3.1. But my Gradle is not getting synced.

error

gradle file

I have already added the Maven code from Gradle Dependancy on this url: https://github.com/chrisbanes/PhotoView

halfer
  • 19,824
  • 17
  • 99
  • 186
Raj Suvariya
  • 249
  • 1
  • 4
  • 14

7 Answers7

14

I had this issue and solved this by adding the repository in buildscript. Here you can see my build.gradle (not the module, but the project one) :

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

buildscript {
    repositories {
        maven { url "https://jitpack.io" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

I don't know why I needed to do that because one my friend just added the repository in the allprojects block and it works for him.

senerh
  • 1,315
  • 10
  • 20
3

Add in your gradle.settings:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        maven { url "https://jitpack.io" }
    }
}
Patrick
  • 1,629
  • 5
  • 23
  • 44
2

The latest version of this library is 2.0.0 [ as of 18 Mar 2017] (not 1.3.1) See releases.

Use this in your module level build.gradle:

implementation 'com.github.chrisbanes:PhotoView:2.0.0'

Tested ok (here's where gradle/jitpack found it):

Download https://jitpack.io/com/github/chrisbanes/PhotoView/2.0.0/PhotoView-2.0.0.pom
Download https://jitpack.io/com/github/chrisbanes/PhotoView/2.0.0/PhotoView-2.0.0.aar
Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54
2

Paste this:

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

in settings.gradle, and paste this dependency:

implementation'com.github.chrisbanes:PhotoView:latest.release.here'

in build.gradle.

settings.gradle

ouflak
  • 2,458
  • 10
  • 44
  • 49
0

Add "library" after photoview ex: implementation "com.github.chrisbanes.photoview:library:1.2.4"

https://bintray.com/bintray/jcenter/com.github.chrisbanes.photoview:library#statistics

0

Here is my answer, solved after some attempts !

In your build.gradle file you should have the two last lines.

allprojects {
    repositories {
        google()
        jcenter()

        // for photo view
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
    }
}

Then add the lastest version.

// photo view
implementation 'com.github.chrisbanes:PhotoView:2.3.0'

This should work hope it will helps.

Zhar
  • 3,330
  • 2
  • 24
  • 25
-1

Add to settings.gradle:

dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            jcenter() // Warning: this repository is going to shut down soon
            maven { url "https://jitpack.io" }
        }
    }
sapeg
  • 109
  • 7