Если вы укажете URL-путь в запросе, приложение закрывается, когда вызывается соединение с API. Если вы пишете без параметров, приложение отправляет запрос, и я получаю ответ. В чем может быть причина?
Путь URL: {телефон}
public interface ApiInterface {
@GET("Register?app=CxTaxiWebAPI&phone={phone}")
Call<List<PhoneNumber>> registration(@Path("phone") String phoneNumber);
}
зависимости:
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
запрос:
public void EnterCodeOnClick(View view) {
apiInterface = ApiClient.getClient().create(ApiInterface.class);
Call<List<PhoneNumber>> call = apiInterface.registration("34");
call.enqueue(new Callback<List<PhoneNumber>>() {
@Override
public void onResponse(Call<List<PhoneNumber>> call, Response<List<PhoneNumber>> response) {
Log.e(TAG, "onResponse: " + response.body());
}
@Override
public void onFailure(Call<List<PhoneNumber>> call, Throwable t) {
Log.e(TAG, "onFailure: " + t.getLocalizedMessage() );
}
});