fauno fauno - 1 year ago 113
Android Question

react-native-system-notification NativeModule is undefined on apk release

I'm working on this app project where I need to schedule notifications based on a list of predefined texts. Everything works fine on my dev environment, but when I build the APK release, they won't work. Debugging further I found out the notifications are a NativeModule and it becomes

on the release.

This returns the module attributes on
react-native run-android
in the release:


This is the actual error that led me to it:

.create({ attrs })
.then((n) => console.log('Notification', n)
.catch((err) => console.log(err);


{ [TypeError: undefined is not an object (evaluating 'd.rGetApplicationName')] line: 670 column: 2663, sourceURL: 'index.android.bundle' }

I'm using react-native-system-notification with what I understand is an unrelated modification that removes the GCM requirement.

There's this issue but the project seems inactive since August and the issue is from April.

So, where else should I look for to solve this?

Answer Source

I've disabled proguard from the release and the notifications started to work! No idea how to prevent proguard from messing with the package, but it was only saving 1Mb so I'm happy with this solution.

def enableProguardInReleaseBuilds = false

in android/app/build.gradle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download