Problem with FirebaseDatabase apk-release Android


When I do the tests with apk-debug the data is stored with its correct key in FirebaseDatabase, as it was stipulated in the model.

But when I generate the apk-release, the data is saved but with different keys.

In the attached image frame in green, as they are, the data is left with the apk-debug and in red, as it is, when I generate the app in apk-release.

Do you know why this occurs? and What should I modify to solve it?

Thanks in advance to everyone

asked by Didier 19.02.2018 в 19:13

1 answer


You must configure ProGuard to maintain the names of the properties of your models.

According to the Firebase documentation you must add this configuration to your file:

# Add this global rule
-keepattributes Signature

# This rule will properly ProGuard all the model classes in
# the package com.yourcompany.models. Modify to fit the structure
# of your app.
-keepclassmembers class com.yourcompany.models.** {

(where com.yourcompany.models.** is the package your models are in)

answered by 19.02.2018 / 20:57