Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Networking Getting the OkHttp Library Using Gradle

Okhttp dependecies error

Hi,

I'm having problems when trying to sync the gradle. I got the error "Gradle project sync failed". Here is my dependencies code:

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.squareup.okhttp:okhttp:2.3.0' }

3 Answers

Víctor Hernández
Víctor Hernández
12,276 Points

Maybe you need to add the dependence:

compile 'com.squareup.okio:okio:1.0.1'

okhtttp use okio, only check the version of the okio that you maybe need

I tried that too but did not work. Do you have any other clue?

Víctor Hernández
Víctor Hernández
12,276 Points

I have the same problem when I try to run the project of the Build a Weather App course, my solution was to create a new proyect and copy and paste the java and res folder, and configurate my own build.gradle and AndroidManifest.xml

Can you elaborate a little bit more about that?