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 Working with JSON Introducing JSONObject

facing a new Error with OkHttp.

Initially OkHttp used to work fine but now i am facing a new error when the minumum sdk-version is 16 for the same code the error is: Error: Invoke-customs are only supported starting with Android O (--min-api 26).So wrote the same code again but now i changed to minumum sdk-version to 26 now it was compiled but when it was running the app is closed restart or close your app i don't know how to move any further please help!!! note: i have mentioned uses-permission android:name="internet" in manifest.

2 Answers

Hi Sai. Which version of Java are you working with? Try adding the following compileOptions lines in your build.gradle (Module: app) file:

android {
     compileOptions {
             sourceCompatibility JavaVersion.VERSION_1_8
             targetCompatibility JavaVersion.VERSION_1_8

Hope that helps :)

P.S. The internet permission should be:

<uses-permission android:name="android.permission.INTERNET" />

it worked thank you so much

Happy to hear that. You're welcome :)