[Closed] App crashes on Sony Xperia only

When our users try to open our IAP view, which calls “UnityPurchasing.Initialize”, the screen turns black and the app crashes short after.

This is apparently only happening to Sony XPeria users. The Android version doesn’t matter, as we get reports in the Google Play Developer console for multiple Android versions.

This is the error we can see in the Google Play Developer:

java.lang.Error: FATAL EXCEPTION [AsyncQueryWorker] 
Unity version : 5.6.0f3 
Device model : Sony D2303 
Caused by
at android.os.Parcel.readException(Parcel.java:1465)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:468)
at android.content.ContentResolver.insert(ContentResolver.java:1190)
at android.content.AsyncQueryHandler$WorkerHandler.handleMessage(AsyncQueryHandler.java:96)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)

@Nyankoooo

Our QA team will take a look and do some more testing with XPeria devices. Here is the bug ticket: https://fogbugz.unity3d.com/default.asp?916606_ds9nhb2q

Would you be able to provide some more details about this issue?

  • Would you be able to get a log from a device experiencing this issue?
  • What version of the plugin was this app developed with?
  • Would you be able to provide a sample project where this issue is occurring?

@ap-unity

Thank you for your reply!

Sadly we can’t make a log or reproduce this exception, because we only see this in the Google Developer Console and when we hear from users who can’t use IAP.

I’m not entirely sure which version of IAP we used in this build, but I think it was about two updates ago. Maybe that helps you to narrow it down a little.

Here are some of the Xperia devices we got reports from:

Xperia Z5 (E6653)
Xperia XZ (F8331)
Xperia Z5 Compact (E5823),
Xperia™ M4 Aqua (E2303)
Xperia Z (C6603)
Xperia XA (F3111)
Xperia Z1 (C6903)
Xperia™ M4 Aqua Dual (E2363)
Xperia XZ (F8332)
Xperia Z3 (D6603)
Xperia E5 (F3311)
Xperia XA (F3116)
Xperia X Compact (F5321)
Xperia X (F5121)
Xperia XA (F3113)
Xperia M2 (D2303)
Xperia X Performance (F8131)
Xperia Z5 dual (E6683)
Xperia Z2 (D6503)
Xperia Z3+ (E6553)

@ap-unity We just tested with one of our users the newest version of Unity IAP, but it still crashes.

@ap-unity Any update on this?

@Nyankoooo

Sorry, there are no updates. We are still looking into this.

@Nyankoooo

Would you be able to provide a link to your app for testing?

@ap-unity
Sure, here you go: https://play.google.com/store/apps/details?id=de.mardukcorp.kawaiinihongo

Hi

i got this error too.
report from google play :

Xperia Z (C6603) 52 12.5%
Xperia Z3 Compact (D5833) 49 11.8%
Xperia Z2 (D6503) 31 7.5%
Xperia Z Ultra (C6833) 29 7.0%
Xperia C5 Ultra Dual (E5533) 26 6.3%
Xperia Z3 (D6653) 26 6.3%
Xperia Z3+ (E6553) 25 6.0%
Xperia M2 (D2305) 19 4.6%
Xperia Z1 Compact (D5503) 18 4.3%
Xperia M5 Dual (E5663) 16 3.8%
Xperia™ C4 Dual (E5333) 14 3.4%
Xperia ZR (C5503) 12 2.9%
Xperia™ E4 Dual (E2115) 11 2.6%
Xperia Z1 (C6903) 11 2.6%
Xperia Z5 dual (E6683) 9 2.2%
Xperia Z2 (SO-03F) 8 1.9%
MI 3W (cancro) 7 1.7%
Xperia Z5 Compact (E5803) 7 1.7%
Xperia™ M4 Aqua (E2353) 6 1.4%
Xperia M2 dual (D2302) 6 1.4%
Others 34 8.2%

any update about this?

Hi,
I got the same error with many devices:
Xperia XA Ultra (F3213) 9 9,9%
Xperia Z3+ (E6553) 9 9,9%
Xperia C3 Dual (D2502) 9 9,9%
Xperia XA (F3113) 7 7,7%
Xperia E4g Dual (E2043) 7 7,7%
Xperia Z2 (SO-03F) 6 6,6%
Xperia Z2 (D6502) 6 6,6%
Xperia Z5 Premium Dual (E6833) 5 5,5%
Xperia Z2 (D6503) 4 4,4%
Xperia T2 Ultra (D5322) 4 4,4%
Xperia XA Ultra (F3212) 3 3,3%
Xperia M5 Dual (E5633) 3 3,3%
Xperia™ C4 Dual (E5363) 3 3,3%
Xperia™ E4 Dual (E2124) 3 3,3%
Xperia Z3 (D6603) 3 3,3%
Xperia X (F5122) 2 2,2%
Xperia Z3 Compact (D5833) 2 2,2%
Xperia Tablet Z (SGP321) 1 1,1%
Xperia C5 Ultra Dual (E5533) 1 1,1%
Xperia™ C4 (E5353) 1 1,1%

Here is the link to my app if you want to test:

I need a fix please,
Thanks.

Hi we have the same problem with the same devices.
Here is our app:

It’s seems to be a number one priority problem as it affects the business model all of the apps using your system.

Please answer @ap-unity @nicholasr

@ap-unity @nicholasr
I have found informations about this crash that maybe can help you solve this:
https://stackoverflow.com/questions/40514335/download-manager-android-permissions-error-write-external-storage

Here is the full stack of the error in the Google Play Dashboard:

java.lang.Error: FATAL EXCEPTION [AsyncQueryWorker]
Unity version     : 5.6.2p2
Device model      : Sony D5803
Device fingerprint: Sony/D5803/D5803:6.0.1/23.5.A.1.291/2769308465:user/release-keys
Caused by
  at android.os.Parcel.readException (Parcel.java:1627)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:183)
  at android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:135)
  at android.content.ContentProviderProxy.insert (ContentProviderNative.java:482)
  at android.content.ContentResolver.insert (ContentResolver.java:1240)
  at android.content.AsyncQueryHandler$WorkerHandler.handleMessage (AsyncQueryHandler.java:96)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:234)
  at android.os.HandlerThread.run (HandlerThread.java:61)

It seems to be the same error. As they say in the stack overflow subject, it seems to be related to the fact that you are calling something that is not available in the android version used by the phone. Please can you look at this problem???

@r-pedra Have you been able to confirm that you have the correct permissions, as mentioned in the first answer in the article?

Hi,
We have all these permissions:

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="com.android.vending.BILLING" />

Our game handle permissions asking. When we launch the game we ask for the critical permissions (WRITE_EXTERNAL, COARSE_LOCATION and READ_PHONE_STATE). Before using Unity IAP we were using OpenIAB but it was kind of buggy, so we rewrote our entire IAP system to use yours.

We have almost the same stack trace that the owner of the subject, some lines are differents but the symptoms are the same. All Sony phones affected. At this moment we can’t confirm what exactly is happening because no user reported a particular problem and we have no problems when running on Sony Tablet SGP621 (XPERIA TABLET Z3 COMPACT).
As we have no other Sony device, we really don’t know what’s happening, but we have already 500 reports on Android Vitals that print the same error below and it begans exactly when we released the update including IAP

@r-pedra The article shows some explicit runtime code that you can call that confirms that those permissions are in place, are you able to test? My suspicion is that the OS on Xperia devices isn’t recognizing those settings, can you confirm?

Do you want me to create a test app that run this code? The problem is that we don’t have a device that have the bug so it will be pointless. Do you have any of the devices below?

We have obtained an Xperia device to test on, I should have results early next week.

2 Likes

I tested on an Xperia SGP311 and an Xperia LT26w with no issues, although they don’t have external storage. The phone does have a Micro SD card slot, I will test again in the next day or so and provide my results. In the meantime, if any user on here has an affected device to test with, please test with the code mentioned here xml - Download Manager Android Permissions error: write external Storage - Stack Overflow

We have bought 2 Xperia too, Xperia M and Xperia XA Dual and we are not able to find the bug. We don’t have SD card to test but we didn’t encoutered any problem. The thing is that we now have more than 1000 thousand reports in Android Vitals and we still can’t figure how to have this crash. I think with this amount, that the crash does not occurs when buying an item (as we don’t have this amount of Xperia buying things usually) and I think that the app does not quit as we don’t have any report from our users that there is a problem.
The fact is that Android Vitals is now a part of the ranking of an app, “Crashes” (as Android Vitals calls this) increased by more than 200% and that is not acceptable on our side.
I know it seems to be something hard to find but these figures shows that it occurs on many devices, and it should not be ignored because it’s decreasing ranking of apps.
If you have any news, please tell us.

The few users that reported the issue directly to us had problems with opening our IAP view, which loads the standard code for Unity IAP.
Maybe this helps with looking for the issue.