UnityWebRequest Cannot resolve destination host from google drive file on Android

I am using Unity 6.0000.28f. I have a VR app that I build for Vision Pro and Quest 2. Everything works fine on Vision Pro. My issue is on Quest 2 only.

I have the following code:

private const string URL = "https://drive.google.com/uc?export=download&id=1FiaeXi6MkceyuAAV10jTU0BMvzk2NetO";

void Start()
{
    ProgressText.text = "Downloading...";
    StartCoroutine(GetText());
}

IEnumerator GetText()
{
    UnityWebRequest www = new UnityWebRequest(URL);
    www.downloadHandler = new DownloadHandlerBuffer();
    yield return www.SendWebRequest();

    if (www.result != UnityWebRequest.Result.Success)
    {
        ProgressText.text = www.error;
    }
    else
    {
        ProgressText.text = "Downloaded";
    }
}

The file I am trying to download comes from my google drive. It is just a glTF file and the link is public.

When I execute this on Android on the Quest I get this error:

Cannot resolve destination host

If I simply change:

StartCoroutine(GetText());
to
Application.OpenURL(URL);

It will open the browser and download the file, so I am sure it isn’t a network issue on the Quest itself.

What do I have to do to make this work on the Quest?

Do requests to other host work?
That error usually means no network connectivity, but it could also mean DNS issues.

I also tried www.google.com and that did not work either.

Since the browser worked I don’t think it is a network or dns issue.

I suspect a setting or config or permissions issue in Unity for android. That is why I posted here.

Check the built apks manifest. Maybe internet permission is not in there.
Easiest to open apk in Android Studio.

I used Android Studio to open the .apk file and look at the AndroidManifest.xml file.

I did NOT see the INTERNET permission in there.

I went back to the Unity project settings and see that Internet was set to Auto.

I changed it to Required and built the app again.

Before running it I checked the .apk file again and still no INTERNET permission.

So I created an AndroidManifest.xml file using the custom main manifest option in Unity. I then opened the AndroidManifest.xml file in the plugins/android folder and added this line:

<uses-permission android:name="android.permission.INTERNET"/>

Right after the Application element.

I built the apk again and still not INTERNET permission in the AndroidManifest.xml file in the apk.

Any ideas why I can’t seem to get the INTERNET permission to show up?

Found this and it sounds awfully similar to your issue:
https://www.reddit.com/r/vrdev/comments/15cgj7w/comment/jubg5oh/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

What OpenXR package version do you use? I’m pretty sure that permission bug was already fixed, in 1.9.x versions

You are awesome. I wasn’t adding Meta or Quest to my google searches because it did not occur to me that would have anything to do with it. It seemed more like a generic networking or Unity issue.

Thank you a ton!

That made it so that the INTERNET permission is now in the final apk.

I will have to test this fix later when I am back at the other office.

I am curious why they have such a setting. Is it because the internet is always there anyway?

I am hopeful this will fix it, but not sure because it seems like maybe the Quest always has internet access and maybe this is still a bug in Unity.

I am using 1.31.1 so it is still there at that point.

I’m not very familiar with XR area, but as far as I can see Unity OpenXR package doesn’t have such version

I am confused about the version you are asking about. This is where I went to look:

That is from Unity in the package manager.

I have no idea what the 1.9.1 versus 1.13.1 is. 1.9.1 isn’t even shown anywhere that I can find in Unity.

It does seem like I have the 1.9.1 that you are talking about simply because the latest “version” inside that image you posted from the website is 1.13. But I really don’t know if that is a true statement.

That makes sense, except

The setting for force remove is made on purpose, but there was an issue, that it was reenabled after Editor restart. I was referring that one was fixed in 1.9 versions. You’re on a newer, so should contain the fix as well

I see. You were talking about a bug that would reenable that checkbox when you restarted the editor.

I didn’t catch that part. I thought you said some bug related to that checkbox being there at all or its default value.

I can confirm that when I open the editor again the checkbox remains unchecked as I set it.

Sorry for the confusion.

PS The versioning still confuses me a bit because 1.9.x doesn’t seem to show up in the editor package manager anywhere that I can find. Not sure what the 1.9.x version is versus the 1.13.x version. Not important, but just confusing.

1.9 is an older version of the same plugin: Changelog | OpenXR Plugin | 1.13.2
Changelog | OpenXR Plugin | 1.9.1
And that’s expected you won’t see that in Package Manager, why should you see quite an old version when up to date is avalable :slight_smile:

For some reason I thought your image was showing 1.9.1 and the things in the list were some kind of sub version. Now I see 1.9.1 was the selected version and the list was the other versions.

My bad.

1 Like