Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Libraries fail to resolve with https://jitpack.io #4002

Closed
geoffduong opened this issue Oct 4, 2019 · 23 comments
Closed

Android Libraries fail to resolve with https://jitpack.io #4002

geoffduong opened this issue Oct 4, 2019 · 23 comments

Comments

@geoffduong
Copy link

Describe the bug
If you have maven { url "https://jitpack.io" } as your resolving url, then Jitpack will only return the POM for the Android dependency causing the Gradle sync to fail. The workaround currently is to wipe the dependency from your cache and update the resolving url to maven { url "https://www.jitpack.io" }

To Reproduce
Steps to reproduce the behavior:

  1. Setup a new Android Studio project
  2. Add maven { url "https://jitpack.io" } to your root build.gradle
  3. Add implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' to your app module's build.gradle
  4. See error

Expected behavior
POM, AAR, and sources.jar are all resolved for the dependency.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

sjchmiela pushed a commit to expo/expo that referenced this issue Oct 8, 2019
Currently jitpack accessed over jitpack.io doesn't return all required files for artifacts, it only returns POMs. Short investigation would suggest that its Cloudflare configuration is invalid, since jitpack.io goes through Cloudflare CDN. As a temporary workaround, to bypass CDN, we use www.jitpack.io, which goes straight to Jitpack's servers.

See jitpack/jitpack.io#4002.
@vasiledoe
Copy link

Take a look here: https://stackoverflow.com/a/52812651/3595288

@Gryzor
Copy link

Gryzor commented Oct 11, 2019

@vasiledoe this SO issue has been raised on May 17th, 2018. The response is from October, 2018. This GitHub issue was created seven days ago. The StackOverflow question points to this...

@jitpack-io
Copy link
Member

Hi,

What is the error you are seeing when installing com.github.PhilJay:MPAndroidChart:v3.1.0 ?
It'd be great if you could run gradle with the --info flag. That way it'll provide a more detailed error message

@nre-ableton
Copy link

Using www.jitpack.io resolved the issue for me, see expo/expo@bb2d4b0

@Gryzor
Copy link

Gryzor commented Oct 14, 2019

I had troubles with https://github.com/franmontiel/PersistentCookieJar too, I can test later to see if I can repro the issue. (Since it was an old lib, I forked it and included it in my source). I recall I did the fork because it wasn't working when used via Gradle to some developers; we didn't think of trying the www.jitpack vs. just jitpack back then.

In any case, I think both jitpack.io and the github page should agree on what they recommend. Should users use jitpack.io or www.jitpack.io; currently, they resolve to different hosts.

$ dig jitpack.io

; <<>> DiG 9.11.5-P1-1ubuntu2.5-Ubuntu <<>> jitpack.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23299
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;jitpack.io.                    IN      A

;; ANSWER SECTION:
jitpack.io.             300     IN      A       104.24.22.62
jitpack.io.             300     IN      A       104.24.23.62

And

 $ dig www.jitpack.io

; <<>> DiG 9.11.5-P1-1ubuntu2.5-Ubuntu <<>> www.jitpack.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7522
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www.jitpack.io.                        IN      A

;; ANSWER SECTION:
www.jitpack.io.         1564    IN      A       149.56.28.39

@mbwhite
Copy link

mbwhite commented Oct 25, 2019

We're seeing issues with both www.jitpack.io and jitpack.io now...

@geoffduong
Copy link
Author

Hi,

What is the error you are seeing when installing com.github.PhilJay:MPAndroidChart:v3.1.0 ?
It'd be great if you could run gradle with the --info flag. That way it'll provide a more detailed error message

@mbwhite Can you run gradle with the '--info' flag as suggested above and please post the error message? Thanks!

@brandonrains77
Copy link

Has anyone figured out a workaround, been struggling with this for days, with both www.jitpack.io and jitpack.io now

@nre-ableton
Copy link

Hi,
What is the error you are seeing when installing com.github.PhilJay:MPAndroidChart:v3.1.0 ?
It'd be great if you could run gradle with the --info flag. That way it'll provide a more detailed error message

@mbwhite Can you run gradle with the '--info' flag as suggested above and please post the error message? Thanks!

@geoffduong I'll step in here, in the interest of fixing this problem quickly. Here's the output I get for gradle --info test:

> gradle --info test
Initialized native services in: /Users/nre/.gradle/native
The client will now receive all logging from the daemon (pid: 62936). The daemon log file: /Users/nre/.gradle/daemon/5.6.2/daemon-62936.out.log
Starting 2nd build in daemon [uptime: 15.038 secs, performance: 98%, non-heap usage: 15% of 268.4 MB]
Using 4 worker leases.
Starting Build
Settings evaluated using settings file '/Users/nre/Code/AbletonDevTools/project-name/settings.gradle'.
Projects loaded. Root project using build file '/Users/nre/Code/AbletonDevTools/project-name/build.gradle'.
Included projects: [root project 'project-name']

> Configure project :
Evaluating root project 'project-name' using build file '/Users/nre/Code/AbletonDevTools/project-name/build.gradle'.
All projects evaluated.
Selected primary task 'test' from project :
Tasks to be executed: [task ':compileJava', task ':compileGroovy', task ':processResources', task ':classes', task ':compileTestJava', task ':compileTestGroovy', task ':processTestResources', task ':testClasses', task ':test']
:compileJava (Thread[Execution worker for ':',5,main]) started.

> Task :compileJava NO-SOURCE
file or directory '/Users/nre/Code/AbletonDevTools/project-name/src/main/java', not found
Skipping task ':compileJava' as it has no source files and no previous output files.
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.007 secs.
:compileGroovy (Thread[Execution worker for ':',5,main]) started.

> Task :compileGroovy FAILED
Failed to get resource: GET. [HTTP HTTP/1.1 401 Unauthorized: https://www.jitpack.io/com/github/AbletonDevTools/jenkins-pipeline-mocks/maven-metadata.xml)]
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/com/github/AbletonDevTools/jenkins-pipeline-mocks/maven-metadata.xml]
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/com/github/AbletonDevTools/jenkins-pipeline-mocks/]
:compileGroovy (Thread[Execution worker for ':',5,main]) completed. Took 1.725 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileGroovy'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve com.github.AbletonDevTools:jenkins-pipeline-mocks:0.7+.
     Required by:
         project :
      > Failed to list versions for com.github.AbletonDevTools:jenkins-pipeline-mocks.
         > Unable to load Maven meta-data from https://www.jitpack.io/com/github/AbletonDevTools/jenkins-pipeline-mocks/maven-metadata.xml.
            > Could not get resource 'https://www.jitpack.io/com/github/AbletonDevTools/jenkins-pipeline-mocks/maven-metadata.xml'.
               > Could not GET 'https://www.jitpack.io/com/github/AbletonDevTools/jenkins-pipeline-mocks/maven-metadata.xml'. Received status code 401 from server: Unauthorized

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
1 actionable task: 1 executed

Here's our build.gradle file:

apply plugin: 'groovy'

repositories {
  mavenCentral()
  maven {
    url 'https://www.jitpack.io'
  }
}

dependencies {
  compile 'com.github.AbletonDevTools:jenkins-pipeline-mocks:0.7+'
  compile 'org.codehaus.groovy:groovy-all:2.4.12'

  testCompile 'junit:junit:4.12'
  testCompile(
    group: 'com.lesfurets',
    name: 'jenkins-pipeline-unit',
    version: '1.0',
  )
}

sourceSets {
  main {
    groovy {
      srcDirs = ['src', 'vars']
    }
  }
  test {
    groovy {
      srcDirs = ['test']
    }
  }
}

@nre-ableton
Copy link

ping @jitpack-io, this issue is quite severe!

@zeroleak
Copy link

Same issue here, dependency not downloading anymore from android studio.
DNS inconsistency

jitpack.io. 3 IN A 104.24.22.62
www.jitpack.io. 5 IN A 149.56.28.39
Critical issue blocking our developers!

@TodorShopov
Copy link

TodorShopov commented Oct 30, 2019

Hey guys, we've encountered this issue an hour ago and the solution was to remove the previous workaround ('www') and move it to the bottom of the repository list. - maven { url 'https://jitpack.io' }

@zeroleak
Copy link

it seems upgrading to gradle 3.5.1 (and latest android studio) fixed the problem... or maybe it's a coincidence

@gupta-sachin
Copy link

Tried with Studio v3.5.1, android-gradle 3.5.1 and gradle 5.4.1, it failed with below error-

Unable to load Maven meta-data from https://www.jitpack.io/com/github/xxx/xxx/dev-SNAPSHOT/maven-metadata.xml

Worked when used Studio v3.5.1, android-gradle 3.4.1 and gradle 5.2.1

@mbwhite
Copy link

mbwhite commented Nov 1, 2019

Hi,
What is the error you are seeing when installing com.github.PhilJay:MPAndroidChart:v3.1.0 ?
It'd be great if you could run gradle with the --info flag. That way it'll provide a more detailed error message

@mbwhite Can you run gradle with the '--info' flag as suggested above and please post the error message? Thanks!

Sorry been distracted with other work... the issue is acknowledged at least in the issue @AlexTrotsenko mentions above... they have at least responded to somebody on twitter as wel.

@helen-hjy
Copy link

I'm trying to use BarChart and gradle buildings are fine but the xml files says "missing class" error for chart tag I'm using...
image

@Gryzor
Copy link

Gryzor commented May 29, 2020

@helen-jiayuhan I don't see how this is related, but have you tried StackOverflow?

In addition, try Android Studio -> File -> Invalidate Caches -> Invalidate Caches and Restart. Tends to fix most A.S. problems.

@helen-hjy
Copy link

@helen-jiayuhan I don't see how this is related, but have you tried StackOverflow?

In addition, try Android Studio -> File -> Invalidate Caches -> Invalidate Caches and Restart. Tends to fix most A.S. problems.

sorry it's just something stupid with my AndroidStudio.... It just need to close the project and restart... Got me crazy for a long time to find this solution...

@mohit-sharma-87
Copy link

mohit-sharma-87 commented Aug 14, 2020

@geoffduong : I would like to reopen this issue. Today I just faced the same issue, can you please reopen it again.

@max-usenko-aura
Copy link

Hey guys, we've encountered this issue an hour ago and the solution was to remove the previous workaround ('www') and move it to the bottom of the repository list. - maven { url 'https://jitpack.io' }

works! thank you

@mirse
Copy link

mirse commented Jun 24, 2023

in android studio2022.1.1 patch2 gradle plugin version 7.4.2 gradle version 7.5

also have this problem

@nxywxy
Copy link

nxywxy commented Jun 25, 2023

in android studio2022.1.1 patch2 gradle plugin version 7.4.2 gradle version 7.5

also have this problem

I also encountered a similar problem.
Android Studio Flamingo | 2022.2.1 Patch 2
gradle plugin version 7.4.1
gradle version 7.5

I was able to download the dependencies yesterday, and I found this problem when I was working today.

@Lancerer
Copy link

in android studio2022.1.1 patch2 gradle plugin version 7.4.2 gradle version 7.5
also have this problem

I also encountered a similar problem. Android Studio Flamingo | 2022.2.1 Patch 2 gradle plugin version 7.4.1 gradle version 7.5

I was able to download the dependencies yesterday, and I found this problem when I was working today.

How was it solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests