Error: Cannot resolve destination host (Error only in VR build but works good in Debug mode)

In the process of solving this issue I tried the steps given below
1.)

2.)
Updated the AndroidManifest.xml as below

<?xml version="1.0" encoding="utf-8"?>













3.) code REST API call

public static IEnumerator GetRequest(string uri)
{
using (UnityWebRequest webRequest = new UnityWebRequest(uri, “GET”))
{
webRequest.downloadHandler = new DownloadHandlerBuffer();

// Send the request and wait for a response
yield return webRequest.SendWebRequest();

if (webRequest.result == UnityWebRequest.Result.ConnectionError)
{
// Log any errors
Debug.Log(“: Error: " + webRequest.error);
}
else
{
// Log the response
Debug.Log(”: Received: " + webRequest.downloadHandler.text);
}
}

}

called GetRequest(“https://www.google.com/”)

ran the build and tested on VR pro but not working as expected.
Please help me with this Thank you

1 Like

I had the same problem happening on an Android build for Quest 2 and the reason was because Internet Access permissions were being automatically REMOVED after building. To solve this I had to do the following:

  • Project Settings > OpenXR > Click the gear icon on Meta Quest Support > Uncheck Force Remove Internet Permissions
  • Player Settings > Set Internet Access to Require.

To verify if your Manifest changed. Download Android studio and use the APK analyzer to look at your post build Android Manifest.