Java.lang.IllegalArgumentException: Invalid character in schema with index 0: localhost

I am developing an Android application that receives data from a server (localhost - mssql and nodejs), saves the data, and then displays them

after receiving server response i get this error

Follow the instructions below enter the link here , not the web server, I use localhost. Thanks 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) 
+9
source share
2 answers

you must remove the place from the url and define the http or https scheme

+22
source

If you use localhost, then pass the URL as this- http: // localhost: 8080 / api / notes it is important to define a scheme (http / https) do not use space either.

0
source

Source: https://habr.com/ru/post/1211773/


All Articles