0

I had an app on Google Play that went live but when the 1st customer who installed it couldn't sign into the app, I was advised by another developer to generate a signed APK (filename: app-release.apk) and then drag it onto my emulator for testing. I did this and I got an error when trying to sign in, so I unpublished the app until I fix this.

I then tried by building an APK which gave me a file: app-debug.apk. I dragged this onto my emulator and was able to sign in with no issues.

What might I be doing wrong?

When I run the app from Android Studio onto the emulator, it runs fine, and signs me into my Firebase Database authenticated accounts.

halfer
  • 19,824
  • 17
  • 99
  • 186
LizG
  • 2,246
  • 1
  • 23
  • 38

2 Answers2

1

You might have enabled obfuscation (R8) for release builds and not written the required -keep rules for it. Without a stack-trace this is quite a theoretical question, but likely it would show a ClassNotFoundException, because the name of some class or class member had been obfuscated, which shouldn't have been obfuscated.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • I believe i did enabled obfuscation for the release build, would this be causing my issue with users not being able to sign in? In my app gradle file, this is what i have, what should i fix? : buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } – LizG Nov 25 '21 at 16:49
  • thanks for your response Martin. Should i take out the true value for minifyEnabled? or do i need to add something to proguardFiles? – LizG Nov 25 '21 at 16:59
  • 1
    @LizG It's sub-optimal to publish alike that, better write the `proguard-rules.pro` (these rules vastly vary from app to app, depending on which dependencies where used). One can even add more than one `*.pro` entry there, so that one can organize them better. – Martin Zeitler Nov 25 '21 at 17:05
  • So i should keep minifyEnabled true? I changed to false and it works after i generated a signed apk and dragged the app-release.apk to my emulator and signed in successfully. But when i publish, will i be faced with the obfuscation error? – LizG Nov 25 '21 at 17:36
  • `minifyEnabled` is basically allowing Proguard to strip "unused" code from the app - but sometimes it can't tell when code is actually being called (e.g. if you're using reflection, or a library's creating generated code). So the `proguard-rules` files allow you to whitelist things to ensure they're retained. If disabling `minify` makes it work, that's probably where your issue is, but it's impossible for us to know what's happening in your app specifically. If you investigate, check the docs for libraries you're using (especially network stuff) to see if they provide proguard rules to add – cactustictacs Nov 25 '21 at 23:40
1

Your project may be using specifying different servers for debug and release builds. This is a common practice when you don't want to corrupt the release database with debug/testing data. See this SO post for an example. I'd check your build gradle and see if I could spot something like this there.

So, the release server may be down, whereas the debug server may still be up and running.

auspicious99
  • 3,902
  • 1
  • 44
  • 58
  • I changed the value of minifyenabled to false, then Generated a signed APK and installed on my emulator and seems to be working now. But when i upload to Google Play, it tells me i need to set to true to Publish, so what can i do? Do i need to add something to the ProguardFiles? – LizG Nov 25 '21 at 17:02
  • 1
    Normally, it would be better to keep minifyenabled as true and write appropriate rules in `proguard-rules.pro`. But if you just want to get it in the PlayStore as quickly as possible, nothing is technically stopping you from setting minifyenabled to false. – auspicious99 Nov 25 '21 at 17:20
  • but setting minifyEnabled to false - will that generate an obfuscation error in Google Play Console when publishing app? – LizG Nov 25 '21 at 17:38