简体   繁体   中英

Android app - bugs showing only in release bundle

I recently uploaded my first Kotlin-Android app to a closed testing (alpha) track in Google Play Console. The review was complete and I shared my link to some testers. Unfortunately the release bundle has major bugs that are not present in the debug APK. (the one that generates automatically when I hit "Run" in Android Studio). I checked both bundles on my device and the debug version works perfectly fine while the release is unusable? Is there anyway to debug a release version??. Or maybe create a debuggable build that mimics it's behaviour (as a release build is set to be undebugable for safety reasons...)? Is there a way to see the app logs? (or are they removed in the release build?)

I think it's important to mention that all bugs are related to Firebase actions. My Firebase project have all the needed "SHA certificate fingerprints" (SAH-1 & SHA-256 for the debug, upload & app-signing keys). Maybe another thing is missing?

Maybe the specific bugs can point to the root of the difference, so these are my 2 biggest bugs:

  1. Each user document holds a list of items which is shown in a recyclerView in one of his screens. In the release version no item is shown. I checked the Firestore console and the items are added successfully (from any version) and they show when I sign in the same user with the debug version.
  2. Can't sign in via phone number (in Firebase auth pre-built UI). The other methods work fine. I can even link a phone to an existing account, but the pre-built sign-in flow stops after I enter a phone number and resets to the initial screen. In the debug version that works fine.

Did someone encounter anything like that?

Any help would be appreciated.

you can add this debuggable true in your gradle file

release {
        debuggable true
        minifyEnabled false
        shrinkResources false
    }

this will help you debug the release version, make sure that minifyEnabled and shrinkResources are false

to run the Release version of the app with the Release Keystore use this

signingConfigs {
    release {
        storeFile file('file location')
        storePassword 'your store password'
        keyAlias 'your key alias'
        keyPassword 'your key password'
    }
}

and then add in the variant of release this

release{
    signingConfig singingConfigs.release
}

I found the way to debug the release bundle. The problem was that the "release" build variant used the default signing key - the debug key. I had to Configure the build process to automatically sign my app with a secured key. At the end, I have the following code in my "build.gradle (:app)" file:

...
def keystorePropertiesFile = rootProject.file(<keystore.properties file location>)
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    signingConfigs {
        ionce {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
...
    buildTypes {
        release {
...
            signingConfig signingConfigs.ionce
        }
    }
...
}
...

(I choose to Remove signing information from my build files . If you do, pay attention to the "\" orientation in the storeFile field as the error is not very informative. This answer helped me)

If anyone also encounter one of the two issues I mentioned, here are the solutions:

  1. The difference between the build variants was that in my "release" variant I use minifyEnabled true , which changes the attributes' names to minify the code. When getting the document from Firestore it did not match the object structure and failed to load the list. The solution is in this answer .
  2. This one was not related to the difference in build types - seems I didn't check the feature after upgrading firebase-auth library in my gradle. Upgrading the firebase-ui-auth library, like in this answer , did the trick:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM