Skip to content

Crash in Android release builds due to missing ProGuard keep rules (com.haptics stripped) #14

@omidshafaei

Description

@omidshafaei

Hi 👋
I’m experiencing a crash in Android release builds when using react-native-nitro-haptics.
The issue does not occur in debug mode.

After investigation, it turns out that R8 / ProGuard strips the com.haptics package, which causes the crash at runtime.

Adding an explicit keep rule fixes the issue.

Reproduction

  • Enable minifyEnabled true for Android release
  • Build a release APK
  • Trigger any haptic call from react-native-nitro-haptics
  • App crashes at runtime

Working Solution

Adding the following rule to android/app/proguard-rules.pro fixes the crash:
-keep class com.haptics.** { *; }

Suggested Improvement

It would be great if the library could document this ProGuard requirement in the README

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions