9

I am using firebase in my app, in debug apk everything works fine but when I change my build type to release and sign my apk and run the app data is not loaded am I doing anything wrong with rules?

Can't attach debugger to a release mode apk so not getting how to debug this.

Custom sign-in works fine, I am able to login with my registered email and password but data and images are not loading.

I logged in and then trying to show data, I think calls are authenticated

my database and storage rules

Storage Rule

service firebase.storage {
   match /b/example-frienda-backend.appspot.com/o {
    match /{allPaths=**} {
    allow read, write: if request.auth != null;
  }
 }
}

Datastore rules

{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null",
   "geofire": {
     ".indexOn": ["g"],
   }
  }
}
Shivaraj Patil
  • 8,186
  • 4
  • 29
  • 56
  • Is your signing key different for release and debugging? If yes, you need to also add SHA-1 signed with release key into firebase console. – Dexter Jul 26 '16 at 10:40
  • Yeah, I just added both SHA-1 for debug and release key and downloaded new google-services.json and added to my project but still not working images & data not loading. – Shivaraj Patil Jul 26 '16 at 11:05
  • there will be only one api key right? – Shivaraj Patil Jul 26 '16 at 11:53
  • API keys , OAuth clients and few hash certificates. – Dexter Jul 26 '16 at 12:52
  • Yup, It has all of those but still app data is not loading :( please some one help me it's stopping my app release. – Shivaraj Patil Jul 28 '16 at 05:48
  • 8
    Are your database classes are POJO models and are you using proguard ? It will obscure names. I had this problem with Firebase Database. Don't know about storage. You can try to debug with release apk. Use "android device manager" and filter on your app PID. This will show you LogCat messages for every app in your mobile. – Dexter Jul 28 '16 at 06:00
  • 2
    Oh my holy god, that worked man. I don't know how to thank you, actually I had already added that to my proguard but later I changed my package name but it didn't reflected in proguard now after reading your comment I just looked again it was pointing to old package name. I just changed and it worked like charm. Thaaaaanks a ton man. thanks. @Dexter you are really Dexter Morgon. Lol – Shivaraj Patil Jul 28 '16 at 07:33
  • 1
    Sounds like an answer @Dexter – Rosário Pereira Fernandes Jan 23 '18 at 22:55
  • 1
    You helped me greatly. The package name had not changed on proguard – Bro Nicholas Jan 27 '19 at 00:13

3 Answers3

7

The Proguard is creating problem in your case you need to check proguard rules make sure your all Pojo classes are listed in proguard.

Better option is places all your Pojo classes in a same package and add this

-keep class com.memes.trollfootball.data.db.model.** { *; }

into your proguard-rules.pro file.

Nouman Ch
  • 4,023
  • 4
  • 29
  • 42
1

Please have a look at below link I have answered similar issue.

https://stackoverflow.com/a/59626147/5435517

Also in your case check you have added SHA properly to your fire base project, Firebase rules for your app.

Deepak Rai
  • 138
  • 10
1

When building a release apk the signature "SHA-1" of the apk changes.So if you try to login in your app Using firebase-auth it will give you a toast like "f.f.d.o.d:10" and also it will not load data.

So you should do this:- Go to your firbase project and under "project-setting" goto "Your apps" and there just click on "add fingerprint" and then add your release apk fingerprint "SHA-1" and "SHA-256". If your data is still not loading or the app is crashing on fetching and setting data.Then in your build.gradle(:app) change this to : minifyEnabled false.Just look at the image for correction.