HttpUrl url = new HttpUrl.Builder().scheme("http")
                .host("localhost:8080") // here I'm getting error
                .addPathSegment("organization").build();


这是错误=>
java.lang.IllegalArgumentException:意外的主机:localhost:8080

最佳答案

它的:

HttpUrl url = new HttpUrl.Builder().scheme("http")
            .host("localhost")
            .port(8080)
            .addPathSegment("organization").build();

关于java - 我正在尝试建立url但出现异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54007429/

10-10 06:39