purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

NoClassDefFoundError in BillingFlowParams

Open PawlikMichal25 opened this issue 10 months ago • 7 comments

Environment

  • [X] Output of flutter doctor
[✓] Flutter (Channel stable, 3.27.2, on macOS 15.1.1 24B91 darwin-arm64, locale en-PL)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.
  • [X] Version of purchases-flutter 8.4.4
  • [X] Testing device version: Vivo Y53, Alcatel Tab Mini 7, Wind River A37; Android 6, Android 5
  • [X] How often the issue occurs? On production, I updated 2 days ago and got 3 reports already. Definitely doesn't happen to everyone, but it didn't happen ever before.
  • [X] Stacktrace
          Fatal Exception: java.lang.NoClassDefFoundError: o1.j0
       at com.android.billingclient.api.BillingFlowParams$Builder.build(com.android.billingclient:billing@@7.1.1:1)
       at com.revenuecat.purchases.google.BillingWrapper.buildOneTimePurchaseParams(BillingWrapper.kt)
       at com.revenuecat.purchases.google.BillingWrapper.buildPurchaseParams(BillingWrapper.kt)
       at com.revenuecat.purchases.google.BillingWrapper.access$buildPurchaseParams(BillingWrapper.kt)
       at com.revenuecat.purchases.google.BillingWrapper$makePurchaseAsync$2.invoke(BillingWrapper.kt:2)
       at com.revenuecat.purchases.google.BillingWrapper$makePurchaseAsync$2.invoke(BillingWrapper.kt:1)
       at com.revenuecat.purchases.google.BillingWrapper.executePendingRequests$lambda$3$lambda$2$lambda$1(BillingWrapper.kt:7)
       at android.os.Handler.handleCallback(Handler.java:815)
       at android.os.Handler.dispatchMessage(Handler.java:104)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:5911)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)
  • [X] Steps to reproduce: I don't know how to reproduce it, it works fine on my Pixel. However, since it didn't happen before, I'm guessing it could be easy for you to dissect difference between libraries versions. I recently upgraded from 8.2.2 to 8.4.4

PawlikMichal25 avatar Feb 04 '25 08:02 PawlikMichal25

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Feb 04 '25 08:02 RCGitBot

Hi @PawlikMichal25 - just to confirm, you can't reproduce this at all on your Pixel with a release build?

Can you share a list of your dependencies by running:

./gradlew :app:dependencies

where app is the name of your app’s Gradle module?

Jethro87 avatar Feb 07 '25 16:02 Jethro87

Yes, I mean I tested basic use cases on my Pixel 3 and they worked fine.

Output of running the command in file: log.txt

PawlikMichal25 avatar Feb 07 '25 19:02 PawlikMichal25

Thank you for the logs. Can you now use retrace to deobfuscate this so we can learn what the o1.j0 class is that can't be found? You should be able to use the mapping file of the exact version that the stack trace occurred in. You can find this on the Play Console:

  1. Test and release -> App bundle explorer
  2. Select the same version as the one the stack trace occurred in.
  3. Downloads -> Download the original file
  4. Replace the .aab extension with .zip and extract
  5. Find the mapping file in BUNDLE-METADATA/com.android.tools.build.obfuscation.

Jethro87 avatar Feb 21 '25 19:02 Jethro87

Same issue, is there a solution?

wnoiokjfwa avatar Mar 04 '25 17:03 wnoiokjfwa

@wnoiokjfwa Can you provide the files requested in this issue so we can investigate? Please follow this comment and this comment. Thanks.

Jethro87 avatar Mar 07 '25 22:03 Jethro87

Hi @PawlikMichal25 and @wnoiokjfwa, we investigated this issue and it is caused by the Play Billing Library. This is reported to Google here:

  • https://issuetracker.google.com/issues/377466571
  • https://issuetracker.google.com/issues/404645683

The Play Billing Library started using certain Java 8 types, which not all devices can handle.

Until they fix this, the only workaround is to enable Core Library Desugaring in your Android app. To do so, you can follow the instructions here. Let us know if you have more questions!

JayShortway avatar Mar 26 '25 17:03 JayShortway

Hey all!

Going ahead and closing this - but feel free to reopen/reach out at any point if there's any follow up.

Thanks for reporting!

GuilhermeMota93 avatar Oct 14 '25 15:10 GuilhermeMota93