java.lang.IllegalArgumentException:非法 URL 进行改造
java.lang.IllegalArgumentException: Illegal URL with retrofit
我正在尝试在我的应用程序中调用 api
我有以下 url 模板
test-test.domainname.com/feeds/json/v3/attribute/attribute
我正在使用改造 2
但我得到以下致命异常
Illegal URL: test-test.domainname.com
这是我的界面
public interface Iinterface{
@GET("feeds/json/v3/attribute/"+attribute)
Call<ArrayList<result>>getresult();
}
谁能帮我解决这个问题...
您没有协议部分。前置 http://
或 https://
取决于哪个适用于您的 url --
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://test-test.domainname.com")
// ... other retrofit options
.build();
我的基地URL在这里:http://myapiname.azurewebservices.net
喂食方法是这样的:
public interface Iinterface{
@GET("/feeds/json/v3/attribute/"+attribute)
Call<ArrayList<result>>getresult();
}
并且工作完美。请添加 http or https
并重试
就我而言,
我的基础 url 包含 space 个字符 。 (例如 http://myapiname.azure webservices.net
)
我通过删除我的基地 URL.
中的 space 修复了这个错误
Illegal URL Exception in retrofit is triggered when your passed url is
not really existed or not fix with url standard.
我正在尝试在我的应用程序中调用 api 我有以下 url 模板
test-test.domainname.com/feeds/json/v3/attribute/attribute
我正在使用改造 2 但我得到以下致命异常
Illegal URL: test-test.domainname.com
这是我的界面
public interface Iinterface{
@GET("feeds/json/v3/attribute/"+attribute)
Call<ArrayList<result>>getresult();
}
谁能帮我解决这个问题...
您没有协议部分。前置 http://
或 https://
取决于哪个适用于您的 url --
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://test-test.domainname.com")
// ... other retrofit options
.build();
我的基地URL在这里:http://myapiname.azurewebservices.net
喂食方法是这样的:
public interface Iinterface{
@GET("/feeds/json/v3/attribute/"+attribute)
Call<ArrayList<result>>getresult();
}
并且工作完美。请添加 http or https
并重试
就我而言,
我的基础 url 包含 space 个字符 。 (例如 http://myapiname.azure webservices.net
)
我通过删除我的基地 URL.
中的 space 修复了这个错误Illegal URL Exception in retrofit is triggered when your passed url is not really existed or not fix with url standard.