Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 FLAG_IMMUTABLE or FLAG_MUTABLE causing app crashes in Unity Android Build #585

Open
smart09091 opened this issue Nov 6, 2023 · 6 comments
Labels

Comments

@smart09091
Copy link

Configuration

  • SDK Version Mapbox v2.1.1
  • Android OS Version Android 13
  • Device model(s): Poco F3
  • App: Unity Mapbox SDK

Steps to Reproduce
It happens intermittently but whenever my app is doing anything mapbox related like get map information, I get this error
Error Unity Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.IllegalArgumentException: com.nmy.unseen: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 2022.12.23 12:13:16.783 19432 19454 Error Unity 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. it doesnt happen as often but we've noticed that this is usually the last error being logged whenever the app crashes. I've tried to set the target API level of our android app to 30 for the meantime and the errors have disappeared but I dont think this is a good solution especially if we're going to release our app on the playstore

Expected
Is there a fix for unity that addresses this? I've seen a few issues that suggest editing .jar files to add the FLAG_IMMUTABLE line of code but I dont know how to implement these fixes for the unity app. Can I ask for help on how to remedy this or if there's already a fix for this, could someone point me in the right direction?

Logging
Error Unity Error initializing telemetry: UnityEngine.AndroidJavaException: java.lang.IllegalArgumentException: com.nmy.unseen: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 2022.12.23 12:13:16.783 19432 19454 Error Unity 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.

@smart09091 smart09091 added the bug label Nov 6, 2023
@smart09091 smart09091 changed the title 🐞 FLAG_IMMUTABLE or FLAG_MUTABLE causing app crashes 🐞 FLAG_IMMUTABLE or FLAG_MUTABLE causing app crashes in Unity Android Build Nov 6, 2023
@tatiana-yan
Copy link
Contributor

tatiana-yan commented Nov 20, 2023

Hello! Thank you for the report. The issue arises because Mapbox Events Android does not support SDK 31 and higher. We are considering either removing this dependency from the Unity SDK or updating Mapbox Events Android to support the latest Android SDK. It may take some time, we will post an update here.
Internal ticket number: CORESDK-2223.

@tatiana-yan
Copy link
Contributor

We decided to release a new version of Unity SDK with the removed mapbox-events-android dependency.
We expect it early next year. Until then, we recommend having Android SDK 30 as a target. It does not prevent your application from being executed on newer Android versions, it just enables backward compatibility behaviors intended for older app versions.

@vanisrimursha
Copy link

Hello! Thank you for the report. The issue arises because Mapbox Events Android does not support SDK 31 and higher. We are considering either removing this dependency from the Unity SDK or updating Mapbox Events Android to support the latest Android SDK. It may take some time, we will post an update here. Internal ticket number: CORESDK-2223.

Any updates on this??

@brnkhy
Copy link

brnkhy commented Mar 28, 2024

@smart09091 , @vanisrimursha
I tried to update a few old libraries with new versions, it would be great if you can give this new branch MME a go and let us know if it solves the problem for android builds.
https://github.com/mapbox/mapbox-unity-sdk/tree/mme

@brnkhy
Copy link

brnkhy commented Mar 28, 2024

@smart09091 @vanisrimursha
upon some further testing, I think that branch isn't good yet, I'll let you know when some other issues are fixed and it's ready.

@brnkhy
Copy link

brnkhy commented Apr 4, 2024

@smart09091 @vanisrimursha
after some more tests and improvements, I pushed the proposed fix here;
https://github.com/mapbox/mapbox-unity-sdk/tree/androidEventsFix

I tested using target version 33 and android 14.
please let me know if there's anything not working (or if you have any suggestions), I'm trying to fix this issue completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants