Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 :)