Search code examples
kotlinandroid-studioretrofit

Caused by: java.lang.IllegalArgumentException: Invalid URL port: "*************"


This is my url in Network Module:

 private const val BASE_URL = "http://localhost:192.168.29.20/api/"

I got this error:

Caused by: java.lang.IllegalArgumentException: Invalid URL port: "*************"


Solution

  • It should be "http://Your_4numbers:Your_Port/api/".

    Probably you want something like

    "http://192.168.29.20:some_number/api/" where "some_number" is for the port you are trying to use.