Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incompatible with minification #58

Open
3 tasks done
orestis-z opened this issue Mar 1, 2025 · 1 comment
Open
3 tasks done

[BUG] Incompatible with minification #58

orestis-z opened this issue Mar 1, 2025 · 1 comment

Comments

@orestis-z
Copy link

orestis-z commented Mar 1, 2025

New issue checklist

  • I have reviewed the README and documentation
  • I have searched existing issues and this is not a duplicate
  • I have attempted to reproduce the issue and include an example project.

General information

  • @superwall/react-native-superwall version: 2.0.3
  • React Native version: 0.76.1
  • Expo version (if applicable): 52.0.37
  • Platform affected (Android and/or iOS): Android
  • OS versions affected, e.g. iOS 18.3.1 (if applicable):
  • Devices/Simulators affected:
  • Reproducible in the example app? (Yes/No): No
  • Related issues:

Describe the bug

Assembling a release with proguard enabled fails with

> Task :app:minifyReleaseWithR8
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in .../android/app/build/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class java.awt.Component (referenced from: long com.sun.jna.Native.getWindowHandle0(java.awt.Component))

JNA is dependency of superwall:

|    |    +--- com.superwall.supercel:supercel:0.1.17
|    |    |    +--- net.java.dev.jna:jna:5.14.0
|    |    |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
|    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0 (*)

Ignoring it in proguard leads to the following runtime error:

Rejecting re-init on previously-failed class java.lang.Class<com.sun.jna.Native>: java.lang.UnsatisfiedLinkError: Can't obtain peer field ID for class com.sun.jna.Pointer

Steps to reproduce

  1. enable minification with proguard
  2. assemble release

Other Information

@orestis-z
Copy link
Author

orestis-z commented Mar 1, 2025

Temporarily fixed by add this to proguard-rules.pro:

-keep class com.sun.jna.** { *; }
-keep class net.java.dev.jna.** { *; }
-keepclasseswithmembers class * {
    native <methods>;
}

-dontwarn java.awt.Component
-dontwarn java.awt.GraphicsEnvironment
-dontwarn java.awt.HeadlessException
-dontwarn java.awt.Window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant