9

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?

Shima Erfan
  • 335
  • 1
  • 5
  • 19
  • 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. – Iman Irajian Aug 29 '16 at 09:32
  • I use freegate and proxy settings are set. no difference – Shima Erfan Aug 29 '16 at 10:06
  • In the "HTTP Proxy" section click on **Check connection** and enter the URL https://jcenter.bintray.com/com/android/support/support-media-compat/24.2.0/ for test. If everything is alright, then you should see **Connection successful** prompt. Check it. – Iman Irajian Aug 29 '16 at 10:39
  • no connection, the error is `Problem with connection: no protocol: jcenter.bintray.com/com/android/support/support-media-compat‌​/…` – Shima Erfan Aug 29 '16 at 10:42
  • Check this one: [link](https://jcenter.bintray.com/com/android/support/support-media-compat/24.2.0/) Notice that this URL start with _https_ protocol. – Iman Irajian Aug 29 '16 at 10:46
  • this is ok: `Connection successful` – Shima Erfan Aug 29 '16 at 10:48
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/122090/discussion-between-shima-erfan-and-iman-irajian). – Shima Erfan Aug 29 '16 at 10:50
  • No. These libraries are not in jcenter but locally in your SDK. Did you update the SDK? – Gabriele Mariotti Aug 29 '16 at 11:32
  • yes SDK is updated to last versions – Shima Erfan Aug 29 '16 at 11:46
  • Finally I run the project successfully, please review my solution. – Iman Irajian Aug 30 '16 at 17:44

2 Answers2

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
Deep Patel
  • 2,584
  • 2
  • 15
  • 28
Iman Irajian
  • 197
  • 12
0

Replacing

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

worked for me.

Gulshan
  • 1
  • 4
  • It seems like aliyun is a mirror of default maven repository url which is using alibaba cloud, may also improve download speed. – ibrahim-dogan Jun 04 '21 at 11:56