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 Google Play Services Interacting with Your API Write a Retrofit interface

Josh Gold
Josh Gold
12,207 Points

We need to set up an API client (Google Play Services) Task 1 of 4

In Google Play Services task 1 of 4 for the section Set up an API Client, I get the error "You need to create an interface named 'Api'

Here is my code:

import com.joshbgold.recommendations.model.ActiveListings;

import retrofit.Callback;
import retrofit.http.GET;
import retrofit.http.Query;

public class Api {

    @GET("/listings/active")
    void activeListings(@Query("includes") String includes,
                        Callback<ActiveListings> callback) {

    }
}

1 Answer

Pablo Rocha
Pablo Rocha
10,142 Points

for task 1 make sure you define an interface not a class

public interface Api {
}
Josh Gold
Josh Gold
12,207 Points

Aha! Thanks Pablo I was thinking way too much. The challenge only wants the interface defined in the first step, but the interface doesn't have to do anything yet.

Pablo Rocha
Pablo Rocha
10,142 Points

Hi Josh - Glad to help, let us know if you need help with the other tasks.

can you help me with task 3