Push Notification Register fails after obfuscation

I followed the procedure for push notification setup, and it works perfectly fine.

I have obfuscation enabled in my project, and configured proguard with following,

-dontwarn com.backendless.**
-dontwarn weborb.**
-keep class weborb.** {*;}
-keep class com.backendless.**

Once I run my app with minifyEnabled(Obfuscation enabled), I am getting the following error,

java.lang.RuntimeException: Could not register device on Backendless server: Unable to register device, deviceId cannot be null
 at com.backendless.push.BackendlessBroadcastReceiver.b(SourceFile:148)
 at com.backendless.push.BackendlessBroadcastReceiver$1.a(SourceFile:310)
 at com.backendless.Messaging$2.a(SourceFile:247)
 at com.backendless.async.message.AsyncMessage$FaultHandler.a(SourceFile:83)
 at com.backendless.async.message.AsyncMessage.a(SourceFile:41)
 at com.backendless.core.AndroidCarrier$1.handleMessage(SourceFile:37)

I tried debugging the issue with backendless source, and got a clue,

In registerDeviceOnServer in class Messaging, we have a call using reflection,

Invoker.invokeAsync("com.backendless.services.messaging.DeviceRegistrationService", "registerDevice",

So I added the following line,

-keep class com.backendless.** {
    <methods>;
}

But still I am receiving the same error, only difference is I could see the method names now,

java.lang.RuntimeException: Could not register device on Backendless server: Unable to register device, deviceId cannot be null
at com.backendless.push.BackendlessBroadcastReceiver.onError(SourceFile:148)
 at com.backendless.push.BackendlessBroadcastReceiver$1.handleFault(SourceFile:310)

and I checked through the source, but I couldnt any file named,

"com.backendless.services.messaging.DeviceRegistrationService"

Do you run the app on an emulator or a physical device?

I ran it on a physical device.

I analysed a bit more, and found that the push notification started working, after i skipped all the classes and members of backendless library in proguard,

-keep class com.backendless.** {
*;
}

Thank you for the update. We will modify the documentation to reflect that rule as well. I will mark this topic as “Solved”

Regards,
Mark