Cannot connect to jcenter() in android studio
Asked Answered
D

2

10

I'm trying to import MusicBobber library in android studio. I had download and import the example project but when I sync the project this error showed up:

Error:A problem occurred configuring project ':app'.
    A problem occurred configuring project ':audiowidget'.
    Could not download support-media-compat.aar (com.android.support:support-media-compat:24.2.0)
    Could not get resource 'https://jcenter.bintray.com/com/android/support/support-media-compat/24.2.0/support-media-compat-24.2.0.aar'.  
    Could not GET 'https://jcenter.bintray.com/com/android/support/support-media-compat/24.2.0/support-media-compat-24.2.0.aar'.  
    Connection to 'https://jcenter.bintray.com' refused

when I try to open the https://jcenter.bintray.com , site will open with no problem. also I'm using freegate for proxy. where is the problem and what should I do?

Dogwatch answered 29/8, 2016 at 8:4 Comment(10)
The problem is that your access to the jcenter is limited. So you should use an appropriate proxy software like freegate, hotspot etc. Also you should declare your proxy configuration in the Android Studio, for this purpose, there are different approaches. like HTTP Proxy or configuring the gradle.properties file manually.Conformist
I use freegate and proxy settings are set. no differenceDogwatch
In the "HTTP Proxy" section click on Check connection and enter the URL jcenter.bintray.com/com/android/support/support-media-compat/… for test. If everything is alright, then you should see Connection successful prompt. Check it.Conformist
no connection, the error is Problem with connection: no protocol: jcenter.bintray.com/com/android/support/support-media-compat‌​/…Dogwatch
Check this one: link Notice that this URL start with https protocol.Conformist
this is ok: Connection successfulDogwatch
Let us continue this discussion in chat.Dogwatch
No. These libraries are not in jcenter but locally in your SDK. Did you update the SDK?Khania
yes SDK is updated to last versionsDogwatch
Finally I run the project successfully, please review my solution.Conformist
C
5

In Android Studio, go to

File> Settings...> Appearance & Behavior> System Settings> HTTP Proxy

then choose Auto-detect proxy settings

finally Synchronize your project.

Note:

Make sure your SDK and Android Studio and gradle are update. I run the project successfully with these system's configurations:

  • Android Studio 2.1.3
  • gradle-2.14.1
  • SDK:
  • Android Support Repository 32
  • Google Play services 32
  • Android Repository 32
Conformist answered 29/8, 2016 at 9:20 Comment(0)
R
4

Replacing

jcenter() with maven { url 'https://maven.aliyun.com/repository/jcenter' }

worked for me.

Raddi answered 4/6, 2021 at 3:43 Comment(3)
It seems like aliyun is a mirror of default maven repository url which is using alibaba cloud, may also improve download speed.Yeargain
A real hero, thank you.Decontaminate
Its works for me. 👍Plataea

© 2022 - 2025 — McMap. All rights reserved.