facebook-sdk-for-unity icon indicating copy to clipboard operation
facebook-sdk-for-unity copied to clipboard

FATAL EXCEPTION: Unspecified mutability on PendingIntent (Android 12 Crash)

Open tomas-d opened this issue 3 years ago • 7 comments

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Unity Editor Version: 2020.3.23
  • Unity SDK Version: 11.0.0
  • Installation Platform & Verison: Android version 12

Cause of the crash: Unspecified mutability on PendingIntent. Targeting Android SDK version 31 and above requires that one of
FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. (https://developer.android.com/guide/components/intents-filters#DeclareMutabilityPendingIntent)

Crash Log:

java.lang.Error: FATAL EXCEPTION [main] Unity version : 2020.3.23f1 Device model : samsung SM-G998U Device fingerprint: samsung/p3qsqw/p3q:12/SP1A.210812.016/G998USQU4BUK7:user/release-keys Build Type : Release Scripting Backend : IL2CPP ABI : arm64-v8a Strip Engine Code : true Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.ActivityThread.deliverResults (ActivityThread.java:5848) at android.app.ActivityThread.handleSendResult (ActivityThread.java:5887) at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:54) at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2425) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8582) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:563) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1133) at Caused at android.app.PendingIntent.checkFlags (PendingIntent.java:382) at android.app.PendingIntent.getBroadcastAsUser (PendingIntent.java:673) at android.app.PendingIntent.getBroadcast (PendingIntent.java:660) at com.facebook.AccessTokenManager.setTokenExpirationBroadcastAlarm (AccessTokenManager.kt:121) at com.facebook.AccessTokenManager.setCurrentAccessToken (AccessTokenManager.kt:94) at com.facebook.AccessTokenManager.setCurrentAccessToken (AccessTokenManager.kt:47) at com.facebook.AccessToken$Companion.setCurrentAccessToken (AccessToken.kt:428) at com.facebook.AccessToken.setCurrentAccessToken (Unknown Source:2) at com.facebook.login.LoginManager.finishLogin (LoginManager.java:894) at com.facebook.login.LoginManager.onActivityResult (LoginManager.java:247) at com.facebook.login.LoginManager$1.onActivityResult (LoginManager.java:186) at com.facebook.internal.CallbackManagerImpl.onActivityResult (CallbackManagerImpl.kt:44) at com.facebook.unity.BaseActivity.onActivityResult (BaseActivity.java:51) at android.app.Activity.dispatchActivityResult (Activity.java:8651) at android.app.ActivityThread.deliverResults (ActivityThread.java:5841)

tomas-d avatar Dec 06 '21 11:12 tomas-d

so? any progress?

ErcinDedeoglu avatar Jan 23 '22 07:01 ErcinDedeoglu

@ErcinDedeoglu Facebook seems to not care much about releasing new Facebook Unity SDK. You can however build it yourself. This issue was fixed in more recent version of Facebook SDK, including the one that the github version of Facebook Unity SDK uses. Would be nice if they would actually bother to soon release update for the Facebook Unity SDK. Wouldn't get our hopes up

snorrsi avatar Jan 23 '22 17:01 snorrsi

instead of justifying Russophobia and the genocide of Russian-speaking people, you better learn to work and finally release a fixed sdk!

PaXLiCh avatar Apr 04 '22 09:04 PaXLiCh

I have a similar issue - lots of users crashing at login. 😬

Reproduced in-house

Unity Editor Version: 2021.3.9f1 Unity SDK Version: 14.1.0 Installation Platform & Verison: Android version 12 (Pixel 3 XL)

The exception happens when I try to log in with a Facebook account.

As @snorrsi mentioned above - the issues seem to be patched for a long time in Facebook SDK.

I saw that 29 days ago we have a PR to bump this to v 15.0.0

Still, it seems that the fixes lie in 15.1.0

daltonbr avatar Nov 10 '22 14:11 daltonbr

Sadly to say, I gave up on with Facebook login. After a long time, I deleted it from my apps and lost thousands of users. I will never use it again.

ErcinDedeoglu avatar Nov 15 '22 06:11 ErcinDedeoglu

Ran into the same problem now, as Google enforces API 31 compliance to push apps to the Play store. How could it be that such an issue is still open, after more than one year?! It is so easy to fix, just fixed it for my own Unity plugins within minutes.

Are there instructions on how to build the .aar files yourself? I would prefer to hotfix this for the SDK version I already have installed.

derwaldgeist avatar Jan 22 '23 12:01 derwaldgeist

I now checked where the app crashes. It is in the facebook-core code. Is there a repo where I can find the source code for this?

derwaldgeist avatar Jan 22 '23 12:01 derwaldgeist