java.lang.IllegalArgumentException: Illegal URL with retrofit

我是研究僧i 提交于 2019-11-29 14:38:40
Yasin Kaçmaz

my base URL is here: http://myapiname.azurewebservices.net

and feed method is like that :

public interface Iinterface{
   @GET("/feeds/json/v3/attribute/"+attribute)
   Call<ArrayList<result>>getresult();
}

And working perfectly. Please add http or https and try again

You do not have a protocol section. Prepend http:// or https:// depending on which applies to your url --

Retrofit retrofit = new Retrofit.Builder()
        .baseUrl("http://test-test.domainname.com")
        // ... other retrofit options
        .build();  

In my case, my base url contained space character. (eg. http://myapiname.azure webservices.net )

I fixed this Error by removing space in my base URL.

Illegal URL Exception in retrofit is triggered when your passed url is not really existed or not fix with url standard.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!