Solution 1 :
Maybe you need to use retrofit2.http.Query
instead of android.arch.persistence.room.Query
. Please try to change your import from: import android.arch.persistence.room.Query;
to import retrofit2.http.Query;
Problem :
ApiService.java
I’m relatively new to android.I’m trying to create a online music player app and i am not able to connect to the server api.
It gave me the above error and i don’t know how to fix it. Here are my following code
package lrandomdev.com.online.mp3player.helpers;
import android.arch.persistence.room.Query;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import lrandomdev.com.online.mp3player.models.Album;
import lrandomdev.com.online.mp3player.models.Artist;
import lrandomdev.com.online.mp3player.models.Categories;
import lrandomdev.com.online.mp3player.models.Playlist;
import lrandomdev.com.online.mp3player.models.Track;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
public interface ApiServices {
@GET("audios_api/audios")
Call<ArrayList<Track>> getTracks(
@Query("first") int first,
@Query("offset") int offset,
@Query("q") String query
);
@GET("audios_api/audios")
Call<ArrayList<Track>> getTracks(
@Query("first") int first,
@Query("offset") int offset,
@Query("categories_id") String categories_id,
@Query("album_id") String album_id,
@Query("artist_id") String artist_id,
@Query("playlist_id") String playlist_id
);
// @GET("audios_api/album")
// Call<Track> getAlbum(@Query("artist_id") int artist_id);
@GET("audios_api/audios")
Call<ArrayList<Track>> getPopularTracks(
@Query("first") int first,
@Query("offset") int offset,
@Query("artist_id") int artist_id
);
Comments
Comment posted by Artem Viter
Did you solve a problem ?