yasirkula / UnityNativeShare

A Unity plugin to natively share files (images, videos, documents, etc.) and/or plain text on Android & iOS
MIT License
890 stars 131 forks source link

App crashes when sharing on Android 11 Xiaomi devices #126

Open Andoni14 opened 2 years ago

Andoni14 commented 2 years ago

Description of the bug

My app crashes when sharing on Android 11 Xiaomi devices.

Reproduction steps

Attemp to share a screenshot on Android 11 Xiaomi devices.

Platform specs

Please provide the following info if this is a Unity 3D repository.

Additional info

2021-09-10 15:25:22.149 31234-31257/? E/CRASH: pid: 31234, tid: 31257, name: UnityMain >>> com.Company.Project <<< 2021-09-10 15:25:22.349 31234-31257/? E/AndroidRuntime: FATAL EXCEPTION: UnityMain Process: com.Company.Project, PID: 31234 java.lang.Error: Version '2019.4.13f1 (518737b1de84)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a' Build fingerprint: 'Xiaomi/cepheus_eea/cepheus:11/RKQ1.200826.002/V12.5.1.0.RFAEUXM:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: 2021-09-10 15:25:22+0200 pid: 31234, tid: 31257, name: UnityMain >>> com.Company.Project <<< uid: 10049 signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x75c9186f60 x0 00000075c8f86f20 x1 b4000075346aa890 x2 0000000000000003 x3 0000000000000000 x4 0000000000000000 x5 b40000752665d1b0 x6 ff646464ff717171 x7 ff515151ff585858 x8 00000075c9186f20 x9 0000000000000018 x10 0000000000003238 x11 ff9aa1a1ff8f9292 x12 ff646464ff717171 x13 ff515151ff585858 x14 0000000000000000 x15 0000000000000000 x16 00000075c8f67640 x17 00000076b427aaa4 x18 00000075c817b830 x19 00000075c8f93240 x20 b4000075346aa890 x21 0000000000000003 x22 0000000000000003 x23 00000075c8f845c6 x24 0000000000000018 x25 0000000000003234 x26 0000000000003238 x27 ffffff6100000000 x28 0000000000002a10 x29 00000075c817b5d0 sp 00000075c817b3a0 lr 00000075c833a234 pc 00000075c8333764
backtrace:

00 pc 00000000001b2764 /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)

      #01 pc 00000000001b9230  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #02 pc 00000000001b8f8c  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #03 pc 00000000001b1e38  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #04 pc 00000000001b1df4  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #05 pc 00000000000c996c  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #06 pc 00000000003a23ac  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #07 pc 00000000001f4f64  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #08 pc 00000000001db680  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #09 pc 0000000000369b28  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #10 pc 0000000000688884  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #11 pc 00000000004412dc  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #12 pc 00000000006857c0  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #13 pc 000000000030bd9c  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)

2021-09-10 15:25:22.359 1788-5354/? W/ActivityTaskManager: Force finishing activity com.Company.Project/com.unity3d.player.UnityPlayerActivity 2021-09-10 15:25:22.633 1788-3226/? I/WindowManager: WIN DEATH: Window{9df2320 mode=0 rootTaskId=616 u0 com.Company.Project/com.unity3d.player.UnityPlayerActivity}

yasirkula commented 2 years ago

Hmm, the logs don't tell anything useful as is. Perhaps they can be symbolicated?

Andoni14 commented 2 years ago

Hi, thanks for the quick response, using stacktrace utility I get this log:

2021-09-10 15:25:22.149 31234-31257/? E/CRASH: pid: 31234, tid: 31257, name: UnityMain >>> com.Company.Project <<< 2021-09-10 15:25:22.349 31234-31257/? E/AndroidRuntime: FATAL EXCEPTION: UnityMain Process: com.Company.Project, PID: 31234 java.lang.Error: Version '2019.4.13f1 (518737b1de84)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a' Build fingerprint: 'Xiaomi/cepheus_eea/cepheus:11/RKQ1.200826.002/V12.5.1.0.RFAEUXM:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: 2021-09-10 15:25:22+0200 pid: 31234, tid: 31257, name: UnityMain >>> com.Company.Project <<< uid: 10049 signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x75c9186f60 x0 00000075c8f86f20 x1 b4000075346aa890 x2 0000000000000003 x3 0000000000000000 x4 0000000000000000 x5 b40000752665d1b0 x6 ff646464ff717171 x7 ff515151ff585858 x8 00000075c9186f20 x9 0000000000000018 x10 0000000000003238 x11 ff9aa1a1ff8f9292 x12 ff646464ff717171 x13 ff515151ff585858 x14 0000000000000000 x15 0000000000000000 x16 00000075c8f67640 x17 00000076b427aaa4 x18 00000075c817b830 x19 00000075c8f93240 x20 b4000075346aa890 x21 0000000000000003 x22 0000000000000003 x23 00000075c8f845c6 x24 0000000000000018 x25 0000000000003234 x26 0000000000003238 x27 ffffff6100000000 x28 0000000000002a10 x29 00000075c817b5d0 sp 00000075c817b3a0 lr 00000075c833a234 pc 00000075c8333764

backtrace:
      #00 pc 00000000001b2764 (void JSONRead::Transfer<dynamic_array<double, 0u> >(dynamic_array<double, 0u>&, char const*, TransferMetaFlags, bool) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #01 pc 00000000001b9230 (void JSONWrite::Transfer<unsigned int>(unsigned int&, char const*, TransferMetaFlags) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #02 pc 00000000001b8f8c (void JSONWrite::Transfer<dynamic_array<Matrix4x4f, 0u> >(dynamic_array<Matrix4x4f, 0u>&, char const*, TransferMetaFlags) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #03 pc 00000000001b1e38 (void JSONRead::Transfer<signed char>(signed char&, char const*, TransferMetaFlags, bool) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #04 pc 00000000001b1df4 (void JSONRead::Transfer<signed char>(signed char&, char const*, TransferMetaFlags, bool) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #05 pc 00000000000c996c (_GLOBAL__sub_I_Runtime_Serialize_SerializationCaching_1.cpp at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #06 pc 00000000003a23ac (void InputAxis::Transfer<StreamedBinaryWrite>(StreamedBinaryWrite&) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #07 pc 00000000001f4f64 (NewWithLabelConstructor<VFXRenderer>::NewWithLabelConstructor(MemLabelId, int, char const*, char const*, char const*, int) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #08 pc 00000000001db680 (void std::__ndk1::__sort<bool (*&)(SpriteShapeSegmentData const&, SpriteShapeSegmentData const&), SpriteShapeSegmentData*>(SpriteShapeSegmentData*, SpriteShapeSegmentData*, bool (*&)(SpriteShapeSegmentData const&, SpriteShapeSegmentData const&)) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #09 pc 0000000000369b28 (GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&) at ??:?)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libunity.so (BuildId: c8ec8bb0b22b18bea80c91c45c0162f4ddc31122)
      #10 pc 0000000000688884 (libil2cpp.so not found)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #11 pc 00000000004412dc (libil2cpp.so not found)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #12 pc 00000000006857c0 (libil2cpp.so not found)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)
      #13 pc 000000000030bd9c (libil2cpp.so not found)  /data/app/~~guKAiLgnUVc9sMICGVqzkQ==/com.Company.Project-X3BhZe3hDCEYlPRTy-nbdQ==/lib/arm64/libil2cpp.so (BuildId: 1552134081f4b9b3b4c8f97338bacc27d285bbe9)

2021-09-10 15:25:22.359 1788-5354/? W/ActivityTaskManager: Force finishing activity com.Company.Project/com.unity3d.player.UnityPlayerActivity 2021-09-10 15:25:22.633 1788-3226/? I/WindowManager: WIN DEATH: Window{9df2320 mode=0 rootTaskId=616 u0 com.Company.Project/com.unity3d.player.UnityPlayerActivity} 2021-09-10 15:25:22.633 1788-3226/? W/InputDispatcher: Attempted to unregister already unregistered input channel '9df2320 com.Company.Project/com.unity3d.player.UnityPlayerActivity (server)' 2021-09-10 15:25:22.776 2651-2651/? W/Unity: Not running Unity from an Activity; ignored...

yasirkula commented 2 years ago

Is your game played in landscape orientation? Are you using the SetCallback function?

Andoni14 commented 2 years ago

Is your game played in landscape orientation? Are you using the SetCallback function?

my game is played in landscape left orientation, I'm not using the SetCallback funtion. My code runs as follows:

  private void ShareScreen()
    {
        NativeShare share = new NativeShare();
        share.AddFile(_screenshot);
        share.Share();       
    }

Being "_screentshot" a Texture2D that I create capturing the screen before sharing it.

Thanks.

yasirkula commented 2 years ago

For testing purposes, can you set your game's orientation to portrait and see if it makes a difference?

Andoni14 commented 2 years ago

I don't have access to a Xiaomi device right now, I'll post tests results tomorrow. Thanks for the reply.

Andoni14 commented 2 years ago

Hi yasirkula,

I tested the app in a factory reseted phone and it doesn't crash anymore but when I try to share in landscape mode there are missing apps to share with (Whatsapp ie), in portrait mode seems to be working just fine (all apps are available).

yasirkula commented 2 years ago

I think this issue will remain open for a long while 😢 No clue about the missing apps, it was supposed to be fixed (#56) 😞 Thanks for testing it on a factory reseted phone, though.

aelaff commented 2 years ago

Is your game played in landscape orientation? Are you using the SetCallback function?

I have a fatal error when I put the share function in SetCallback function , so how can I solve this ?

yasirkula commented 2 years ago

I have a fatal error when I put the share function in SetCallback function , so how can I solve this ?

The easiest solution would be to call share function in an Invoke, coroutine or DOVirtual.DelayedCall.