square / in-app-payments-flutter-plugin

Flutter Plugin for Square In-App Payments SDK
https://developer.squareup.com/docs
Apache License 2.0
340 stars 121 forks source link

Didn't find class "sqip.internal.w2.lJsonAdapter" #175

Closed MazenCoder closed 2 years ago

MazenCoder commented 3 years ago

When I click on pay

await InAppPayments.startCardEntryFlow( onCardNonceRequestSuccess: _onCardEntryCardNonceRequestSuccess, onCardEntryCancel: _onCancelCardEntryFlow, collectPostalCode: false, );

the app keeps stopping when the app running in the release.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.academy.app/sqip.internal.CardEntryActivity}: java.lang.RuntimeException: Failed to find the generated JsonAdapter class for class sqip.internal.nonce.j

E/AndroidRuntime(10153): FATAL EXCEPTION: main E/AndroidRuntime(10153): Process: com.academy.app, PID: 10153 E/AndroidRuntime(10153): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.academy.app/sqip.internal.CardEntryActivity}: java.lang.RuntimeException: Failed to find the generated JsonAdapter class for class sqip.internal.w2.l E/AndroidRuntime(10153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2720) E/AndroidRuntime(10153): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2781) E/AndroidRuntime(10153): at android.app.ActivityThread.-wrap12(ActivityThread.java) E/AndroidRuntime(10153): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1508) E/AndroidRuntime(10153): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(10153): at android.os.Looper.loop(Looper.java:241) E/AndroidRuntime(10153): at android.app.ActivityThread.main(ActivityThread.java:6274) E/AndroidRuntime(10153): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10153): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) E/AndroidRuntime(10153): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) E/AndroidRuntime(10153): Caused by: java.lang.RuntimeException: Failed to find the generated JsonAdapter class for class sqip.internal.w2.l

brigadierpratap commented 2 years ago

Any updates on this? I have the same issue!

brigadierpratap commented 2 years ago

It turns out, this is the issue with R8. Simply go to the app/build.gradle add the following config in builtdTypes->release.

minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Create a "proguard-rules.pro" file in app folder and write -keep class sqip.** { *; }

CharmisG commented 2 years ago

Please pull latest code and let me if you are still facing this issue for now I'm closing this issue