Forum Xamarin Xamarin.Android

Allowing Java to handle it's own exception

J_BettJ_Bett USMember
edited January 2017 in Xamarin.Android

I have a third party SDK that uses the following code


public string GetOrCreateDeviceID() {
string DeviceID = java.util.UUID.randomUUID().ToString();
try {
AdvertisingIdClient.Info info = AdvertisingIdClient.getAdvertisingIdInfo(SDK.getBaseContext());
if (info != null) {
DeviceID = info.getId();
}
}
catch (Exception e) {
Log.d("ManagerSDK", "Could not get AdvertisingIdClient.Info - Hit Exception: " + e.toString());
}
return DeviceID;
}

For devices like the Kindle they expect the AdvertistingIdClient call to fail so it can default to using non-Google Play Services code, but when as this code is hit from within the application Xamarin is throwing a "Java.Lang.NoClassDefFoundError" (from line 4) which is not allowing the Java code to handle its own exception. Is it possible to get Xamarin to allow the Java exception handling to happen in the way that this SDK expects?

Sign In or Register to comment.