Giphy / giphy-react-native-sdk

GIPHY React Native SDK
https://developers.giphy.com
Apache License 2.0
68 stars 25 forks source link

App crashing on selection of gif(Android) #90

Closed Aman1706 closed 1 year ago

Aman1706 commented 1 year ago

🐛 Bug Report

If a user tries to select a gif in the GiphyDialog menu, the app crashes This is happening for android and only for an apk or aab build, it works fine when running in debug.

I was using an older version of this package and then bumped it up to the latest, after that this issue occurred.

Looking at sentry I see this error

RuntimeException com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run
New Issue
Unhandled
java.lang.reflect.InvocationTargetException

To Reproduce

(Write your steps here:)

  1. Open the Gif menu on an android device
  2. Select a gif

Your Environment

Reproducible Demo

https://user-images.githubusercontent.com/41548441/207300939-59059877-fbd2-401d-9429-3eedfa320b68.mov

Aman1706 commented 1 year ago

FYI I downgraded the version to 2.0.0 and it works fine there Looks like its some issue with 2.1.0

pshoniuk commented 1 year ago

Hi @Aman1706! Sorry for the delayed response. We can't reproduce the issue with an example app. Could you please create some minimal playground where this problem occurs? Or, if you have more detailed information about the error, such as a stake trace, could you please share it? That would be very helpful

ujjwal-techahead-personal commented 1 year ago

@pshoniuk , I too am facing the same issue. Only happens in release builds on Android.

Here is the error I get if I run my app in Android Studio with the build variant set to release:

--------- beginning of crash E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myproject, PID: 7868 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)  Caused by: kotlin.reflect.full.IllegalCallableAccessException: java.lang.IllegalAccessException: Class java.lang.Class<kotlin.reflect.jvm.internal.calls.CallerImpl$FieldGetter> cannot access private final field com.giphy.sdk.core.models.Image com.giphy.sdk.core.models.Images.downsized of class java.lang.Class at kotlin.reflect.jvm.internal.KCallableImpl.call(Unknown Source:17) at kotlin.reflect.jvm.internal.KProperty1Impl.get(Unknown Source:10) at com.giphyreactnativesdk.s.c(Unknown Source:51) at com.giphyreactnativesdk.s.a(Unknown Source:17) at com.giphyreactnativesdk.s.b(Unknown Source:27) at com.giphyreactnativesdk.GiphyReactNativeDialogModule$b.c(Unknown Source:24) at com.giphy.sdk.ui.views.c.E3(Unknown Source:61) at com.giphy.sdk.ui.views.c.y3(Unknown Source:41) at com.giphy.sdk.ui.views.c.s2(Unknown Source:0) at cc.u0.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7448) at android.view.View.performClickInternal(View.java:7425) at android.view.View.access$3600(View.java:810) at android.view.View$PerformClick.run(View.java:28305) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)  Caused by: java.lang.IllegalAccessException: Class java.lang.Class<kotlin.reflect.jvm.internal.calls.CallerImpl$FieldGetter> cannot access private final field com.giphy.sdk.core.models.Image com.giphy.sdk.core.models.Images.downsized of class java.lang.Class at java.lang.reflect.Field.get(Native Method) at kotlin.reflect.jvm.internal.calls.CallerImpl$FieldGetter.call(Unknown Source:26) at kotlin.reflect.jvm.internal.KCallableImpl.call(Unknown Source:9) at kotlin.reflect.jvm.internal.KProperty1Impl.get(Unknown Source:10)  at com.giphyreactnativesdk.s.c(Unknown Source:51)  at com.giphyreactnativesdk.s.a(Unknown Source:17)  at com.giphyreactnativesdk.s.b(Unknown Source:27)  at com.giphyreactnativesdk.GiphyReactNativeDialogModule$b.c(Unknown Source:24)  at com.giphy.sdk.ui.views.c.E3(Unknown Source:61)  at com.giphy.sdk.ui.views.c.y3(Unknown Source:41)  at com.giphy.sdk.ui.views.c.s2(Unknown Source:0)  at cc.u0.onClick(Unknown Source:2)  at android.view.View.performClick(View.java:7448)  at android.view.View.performClickInternal(View.java:7425)  at android.view.View.access$3600(View.java:810)  at android.view.View$PerformClick.run(View.java:28305)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:223)  at android.app.ActivityThread.main(ActivityThread.java:7656)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

pshoniuk commented 1 year ago

Hi @ujjwal-techahead-personal Thank you for the report. We reproduced the issue on our side. The problem seems to be related to ProGuard misconfiguration. I'll update the status here when we have new information.

pshoniuk commented 1 year ago

@ujjwal-techahead-personal We've released a fix in v2.1.3. Please check it when you get a chance. If the problem still occurs, please reopen this issue or create a new one