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

Jeremiah Shore
Jeremiah Shore
31,168 Points

Android Studio 0.8 beta version - gradle does not support testCompile method

The line of code on GitHub: testCompile 'com.squareup.okhttp:mockwebserver:2.2.0'

Here is the error code: Error:(24, 0) Build script error, unsupported Gradle DSL method found: 'testCompile()'!

All I had to do to resolve was change the line in gradle and resynchronize: compile 'com.squareup.okhttp:mockwebserver:2.2.0'

Thanks for posting this--worked like a charm on 0.8 beta version!

I'm not sure if this is a result of adding this line or if it's something else, but ever since I changed this file to add the compile line, all of my gradle build files have yellow highlights (warnings) throughout them with the note 'dependencies cannot be applied to (Groovy.lang.closure)'. Did that happen to you? If so, were you able to fix it?It looks like its a bug from the .5x days, but I'm not sure if it's going to affect something in my project down the line.

1 Answer

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Good tip - thanks for sharing!