stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.32k stars 917 forks source link

Android 14+ RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED error #2349

Open Basewq opened 5 days ago

Basewq commented 5 days ago

Release Type: Official Release

Version: 4.1+

Platform(s): Android 14/API 34

Describe the bug Trying to run a game on an Android device/emulator with Android 14/API 34 or above will throw the exception like: Java.Lang.SecurityException: ' One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts'

Additional context Issue is identified/explained in this issue https://github.com/dotnet/Silk.NET/issues/2232 There is no workaround for this issue due the check & error being baked into the Android OS and the fix must be implemented in the referenced library.

The solution requires updating Silk library to the version when this issue is closed


The following code will also need to be fixed on our end - testing will need to be done whether it needs to be Exported or if NotExported will suffice: https://github.com/stride3d/stride/blob/10babd2291c5dccb5ff16eae5b7e7cfc16b005df/sources/engine/Stride.Games/Starter/StrideActivity.cs#L43 https://github.com/stride3d/stride/blob/10babd2291c5dccb5ff16eae5b7e7cfc16b005df/sources/engine/Stride.Games/Starter/StrideActivity.cs#L73

Starkium commented 4 days ago

is this definitely not something you can work around? This looks similar to something that was a problem in unreal engine and all we had to do was mark certain things as "exported" during build process.

Basewq commented 4 days ago

is this definitely not something you can work around? This looks similar to something that was a problem in unreal engine and all we had to do was mark certain things as "exported" during build process.

Not possible here, the export declaration must be set in the java file of the SDL library because this was done in code so we need updated libraries. Our dependency is Stride -> Silk -> SDL. This has been fixed on SDL's end. Silk still needs to get the updated SDL code, then compile it for .NET interfacing. Then we update our Silk reference.