Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5.6 - WWW and UknownHostException

Discussion in 'Android' started by Ecliptec_Mobile, Aug 2, 2018.

  1. Ecliptec_Mobile

    Ecliptec_Mobile

    Joined:
    Dec 17, 2017
    Posts:
    33
    Hi,

    I'm having problems with WWW on Android with Unity. Specifically, I'm attempting to download a simple .json file from my own server via the WWW class. Everything works as expected the Editor, however, when I deploy to Android, the WWW returns - UknownHostException - in it's error string. Unfortunately, that's all that is returned and WWW.text is empty, hence i'm limited in information.

    Based upon a number of searches, I've checked that the usual internet/network permissions are present in the AndroidManifest.xml file. I can confirm that they are there, and already were since i'm using them for various ad-plugins.

    I've also tried adding a "crossdomain.xml" policy file to the root of my server tree. Same result.

    I also read that it could be due to breaks in my internet connection. However, I also use the WWW class to download asset bundles from the same server (and domain). They download successfully.

    Anyone help?
     
  2. Ecliptec_Mobile

    Ecliptec_Mobile

    Joined:
    Dec 17, 2017
    Posts:
    33
    Upon further investigation, I realise that the request works happily on the emulator, running Oreo.

    That tells me that it is something to do with my device. My device is a Kindle Fire HD 8 (7th Generation) running Fire OS 5.6.2.0. I have also checked, and I am not connecting to the internet via a proxy.
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    One quite blind guess: can you check the url property in the editor after the download of that file and compare it with the one before?
    Specifically, I think if the server redirects from HTTP to HTTPS or vice versa, it will not work, this is a limitation on Android.

    If it's not the case, look into logcat, maybe it contains something of value that would give a clue.