0

I'm trying to publish an app in Google Playstore that uses firebase realtime database. when Install apk in my device directly from Android Studio it works well in firebase console, showing the values that I have defined to my class User (see image):

enter image description here But when I publish the app and I check firebase console, it appears assigned names of values that doesn't correspond to my User class data (see image):

enter image description here Also I have added to my build.gradle file the Proguard as follow:

buildTypes {
   release {
       shrinkResources true
       minifyEnabled true
       testCoverageEnabled false
       proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
       debuggable = false
             signingConfig = signingConfigs.release

   }
}

and in Proguard file I have added:

#-keepattributes Signature
#-keepclassmembers class com.packegename.folderModel.User.** {
#  *;
#}

But still not working

this is my code:

 auth.createUserWithEmailAndPassword(emailInput, passwordInput)
            .addOnCompleteListener { task ->
                if (task.isSuccessful) {
                    val fbUser = auth.currentUser
                    userId = fbUser!!.uid

                   val user = User(
                        "",
                        "",
                        "",
                        userAppAmountInit,
                        "",
                        nameInput,
                        emailInput,
                        timeStamp,
                        lastNameInput,
                        telephoneInput,
                        "Android"
                    )
                    refDataBaseApp.child(userId).setValue(user).addOnCompleteListener {
                        Toast.makeText(context, "Bienvenue!", Toast.LENGTH_SHORT).show();
                    }

in adition, I have connected the app from google play , to firebase console...

I have been tried to understand what is going on. Is the first time I publish an app. I will appreciate all your help

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
  • 1
    Can you confirm that you actually haven't tried installing the exact same APK that you uploaded to Google Play? To me it looks like proguard butchered your classes. The lines you pasted into your proguard file are commented out, so they are doing nothing. Also unless your package actually is com.packegename, it wouldn't work anyway. If it is com.packegename you shoul probably rename it too. Hope this helps you get to the bottom of it – Mike dg May 27 '20 at 12:48
  • I confirm thait in fact is not the exact same APK (Bundle). should it be? Do you know what could I do? thank you so much for your help – Lady Geraldine Villamil Guerre May 27 '20 at 13:25
  • I agree with Mike here: this definitely looks like ProGuard is still changing your `User` class. As he also pointed out, it looks like you still have the relevant lines commented out in the code you shared by putting a `#` at their start. You'll want to remove those `#` characters to ensure ProGuard leaves your POJO classes unmodified. – Frank van Puffelen May 27 '20 at 13:39
  • I have cloned from github one repository of the same project, and in consequence I had to connect this cloned repository to firebase. then I generated an APK (bundle) and I uploaded it to Google Play. could exist an conflict because of it? – Lady Geraldine Villamil Guerre May 27 '20 at 13:43
  • @Mikedg I just removed those # and verified my package name and POJO name and nothing works. the downloaded app from playstore is not showing my class in firebase – Lady Geraldine Villamil Guerre May 27 '20 at 15:02
  • Have you tried with the uncommented lines? Does it work that way? Please respond with @AlexMamo – Alex Mamo May 29 '20 at 10:01
  • 1
    @AlexMamo yes I tried with the uncommented lines, but after that it must be the anotation `@Keep` in your class to reference to proguard rules. and add `-keepattributes *Annotation*` in progurad rules file. See this answer: [link](https://stackoverflow.com/questions/41969319/android-proguard-firebaselistadapter-are-conflicting.). I solved the problem :) – Lady Geraldine Villamil Guerre May 29 '20 at 14:24

0 Answers0