javalocalhostspring-android

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

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. 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)

Solution

  • you should remove space from url and define scheme http or https