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


No Data in log

Tried all the suggestions from similar questions, nothing seemed to work..

this is my code:

package com.atmindil.stormy;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;

import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response;

public class MainActivity extends AppCompatActivity {

public static final String TAG = MainActivity.class.getSimpleName();

protected void onCreate(Bundle savedInstanceState) {

    String apiKey = "ae6678d46704dc0ddd934769cb358e6a";

    double latitude = 37.8267;
    double longitude = -122.4233;

    String forecastURL = "https://api.darksky.net/forecast/" + apiKey + "/" + latitude + "," + longitude;

    //set up main client
    OkHttpClient client = new OkHttpClient();

    Request request = new Request.Builder().url(forecastURL).build();

    //call object
    Call call = client.newCall(request);
    //asynchronous get
    call.enqueue(new Callback() {
        public void onFailure(@NotNull Call call, @NotNull IOException e) {


        public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
            try {
                if (response.isSuccessful()) {
                    Log.v(TAG, response.body().string()); //printing entire response to the log console
            //catch errors
            catch (IOException e) {
                Log.e(TAG, "IO exception caught: ", e);

    Log.d(TAG, "Main UI code is running, horray!");


What is the problem?