Question by
GameDevKaran · Sep 11, 2020 at 12:15 AM ·
crashsdkcrashinggoogleapplication
ARcore "Session.CheckAvailablity().result" getting "Unknown Error" and App Crashes immediately
Hello Devs, i have been trying to solve this problem since couple of weeks and i failed to solve. this problem is with Google AR core SDK and I am using unity 2019.3.1f1 and Latest arcore sdk.
Problem : When i Check Session.CheckAvailablity(); that is fine no exception catches but after when i trying to get result i always recieved "Unkown Error" on Supported Device and Unsupported Device and after that application crashed immediately.
I have reasearched on Internet but i didn't get any Suitable Option for this.
My Script for Checking "Session.CheckAvailablity()" with different types of function:
using System.Collections;
using UnityEngine;
using GoogleARCore;
using UnityEngine.UI;
using System;
public class TestingARSupport : MonoBehaviour
{
[SerializeField] private GameObject LogPrefab;
[SerializeField] private Transform DebugContainer;
public void Check()
{
StartCoroutine(CheckCompatibility());
}
public void Check2()
{
StartCoroutine(CheckCompatibility2());
}
public void Check3()
{
StartCoroutine(CheckCompatibility3());
}
private void CopyToClipBoard(string Txt)
{
CustomNameSpace.Server.Clipboard = Txt;
}
private IEnumerator CheckCompatibility()
{
CreateLog("");
AsyncTask<ApkAvailabilityStatus> checkTask = null;
try
{
checkTask = Session.CheckApkAvailability();
CreateLog("Checking Request Created");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Create \"Checking Request Created\":</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogExeption(e, this);
}
CustomYieldInstruction customYield = checkTask.WaitForCompletion();
/*try
{
customYield = checkTask.WaitForCompletion();
CreateLog("Please Wait Checking Request Has been Sent");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Create \"Checking Request Created\":</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogException(e, this);
}*/
CreateLog("Checking For Result Please Wait");
yield return checkTask.WaitForCompletion();
CreateLog("Result Created Successfuly");
try
{
ApkAvailabilityStatus result = checkTask.Result;
/*try
{
result = checkTask.Result;
CreateLog("Checking Is Completed, result will be soon");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Load Result:</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogException(e, this);
}*/
switch (result)
{
case ApkAvailabilityStatus.SupportedApkTooOld:
CreateLog("Supported apk too old");
break;
case ApkAvailabilityStatus.SupportedInstalled:
CreateLog("Supported and installed");
break;
case ApkAvailabilityStatus.SupportedNotInstalled:
CreateLog("Supported, not installed, requesting installation");
break;
case ApkAvailabilityStatus.UnknownChecking:
CreateLog("Unknown Checking");
break;
case ApkAvailabilityStatus.UnknownError:
CreateLog("Unknown Error");
break;
case ApkAvailabilityStatus.UnknownTimedOut:
CreateLog("Unknown Timed out");
break;
case ApkAvailabilityStatus.UnsupportedDeviceNotCapable:
CreateLog("Unsupported Device Not Capable");
break;
}
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Load Result:</b>" + '\n' + "<color=red>" + e + "</color>");
Debug.LogException(e, this);
}
}
private IEnumerator CheckCompatibility2()
{
CreateLog("");
AsyncTask<ApkAvailabilityStatus> checkTask = null;
try
{
checkTask = Session.CheckApkAvailability();
CreateLog("Checking Request Created");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Create \"Checking Request Created\":</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogExeption(e, this);
}
CreateLog("Checking For Result Please Wait");
while (!checkTask.IsComplete)
{
yield return null;
}
CreateLog("Result Created Successfuly");
try
{
ApkAvailabilityStatus result = checkTask.Result;
/*try
{
result = checkTask.Result;
CreateLog("Checking Is Completed, result will be soon");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Load Result:</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogException(e, this);
}*/
switch (result)
{
case ApkAvailabilityStatus.SupportedApkTooOld:
CreateLog("Supported apk too old");
break;
case ApkAvailabilityStatus.SupportedInstalled:
CreateLog("Supported and installed");
break;
case ApkAvailabilityStatus.SupportedNotInstalled:
CreateLog("Supported, not installed, requesting installation");
break;
case ApkAvailabilityStatus.UnknownChecking:
CreateLog("Unknown Checking");
break;
case ApkAvailabilityStatus.UnknownError:
CreateLog("Unknown Error");
break;
case ApkAvailabilityStatus.UnknownTimedOut:
CreateLog("Unknown Timed out");
break;
case ApkAvailabilityStatus.UnsupportedDeviceNotCapable:
CreateLog("Unsupported Device Not Capable");
break;
}
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Load Result:</b>" + '\n' + "<color=red>" + e + "</color>");
Debug.LogException(e, this);
}
}
private IEnumerator CheckCompatibility3()
{
CreateLog("");
try
{
Session.CheckApkAvailability();
CreateLog("Checking Request Created");
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Create \"Checking Request Created\":</b>" + '\n' + "<color=red>" + e + "</color>");
//Debug.LogExeption(e, this);
}
CreateLog("Checking For Result Please Wait");
while (!Session.CheckApkAvailability().IsComplete)
{
yield return null;
}
CreateLog("Result Created Successfuly");
try
{
ApkAvailabilityStatus result = Session.CheckApkAvailability().Result;
switch (result)
{
case ApkAvailabilityStatus.SupportedApkTooOld:
CreateLog("Supported apk too old");
break;
case ApkAvailabilityStatus.SupportedInstalled:
CreateLog("Supported and installed");
break;
case ApkAvailabilityStatus.SupportedNotInstalled:
CreateLog("Supported, not installed, requesting installation");
break;
case ApkAvailabilityStatus.UnknownChecking:
CreateLog("Unknown Checking");
break;
case ApkAvailabilityStatus.UnknownError:
CreateLog("Unknown Error");
break;
case ApkAvailabilityStatus.UnknownTimedOut:
CreateLog("Unknown Timed out");
break;
case ApkAvailabilityStatus.UnsupportedDeviceNotCapable:
CreateLog("Unsupported Device Not Capable");
break;
}
}
catch (Exception e)
{
CreateLog("<b>Sorry Failed To Load Result:</b>" + '\n' + "<color=red>" + e + "</color>");
Debug.LogException(e, this);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613011602im_/https://answers.unity.com/themes/thub/images/avi.jpg)