[英]java.lang.IllegalArgumentException: Illegal character in scheme at index 0: localhost
I'am developping an android app that receive an data from server (localhost - mssql and nodejs), save data and then display it我正在开发一个 android 应用程序,它从服务器(本地主机 - mssql 和 nodejs)接收数据,保存数据然后显示它
after receiving the server response I get this error收到服务器响应后我收到此错误
I follow the instructions below enter link description here instead of the web server I use localhost.我按照下面的说明在此处输入链接描述,而不是我使用本地主机的 web 服务器。 Thank you
谢谢
Illegal character in scheme at index 0: 192.168.2.7:3000
java.net.URISyntaxException: Illegal character in scheme at index 0: 192.168.2.7:3000
at java.net.URI.validateScheme(URI.java:419)
at java.net.URI.parseURI(URI.java:363)
at java.net.URI.<init>(URI.java:204)
at cz.uhk.fim.jedlima3.searchrooms.asyncTask.DownloadDatabaseAsync.doInBackground(DownloadDatabaseAsync.java:30)
at cz.uhk.fim.jedlima3.searchrooms.asyncTask.DownloadDatabaseAsync.doInBackground(DownloadDatabaseAsync.java:15)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:864)
您应该从 url 中删除空间并定义方案http
或https
如果您使用 localhost,则像这样传递 url - http://localhost:8080/api/notes定义方案很重要(http/https)也不要使用空间。
While we are using any services which are running on our local machines, please try to call the service by using the http protocal instead of directly calling the service.当我们使用在本地机器上运行的任何服务时,请尝试使用 http 协议调用该服务,而不是直接调用该服务。 Example: localhost:1234/hello(wrong will give the above exception) http://localhost:1234/hello(correct way)
示例:localhost:1234/hello(错误会给出上述异常) http://localhost:1234/hello(正确方式)
确保 URL、 http:// 或 https:// 中没有拼写错误
不要在像这样在属性文件中定义 URL 时输入 ":dev.baseURL=http://localhost:8080/products/
Make sure you do not forget the // in http://确保不要忘记 http:// 中的 //
remove space in the url at the starting point删除起始点 url 中的空间
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.