Problem with SHA-1 key in apk release and debug

3

I finally got an alpha version of my Android app and decided to send it to the Play Store for the first time. As I've never done this before (I'm new to the Android development world), I've read some tutorials and was able to generate a signed app on my Android Studio and get it ready for the Play Store. As this is an alpha version, I created an alpha test group in my Play Store console and added half a dozen friends. Everything works perfectly well. The testers are able to download the app , install and use.

The problem starts when I need to add new features to the app. Obviously the flow for this is to program new features in the android studio and as soon as they are ready to re-generate the% signed% and upload to the Play Store so that it is in charge of distributing it to my alpha testers. Again, I'm following this flow and everything is working out.

However, my app uses some Google apps like Sign In, Google Play Games and Google Maps. And some of these require the OAuth 2.0 client credential created in the Google Developer Console (which has already been created by min and is working correctly) to work. As many of you may know, this particular credential requires the signed apk's SHA-1 key to function properly. Here comes the problem. Every time I'm programming new features for .apk , I have to go to the OAuth 2.0 client credential (go to ) and change the SHA-1 key to the .apk key debug . Which obviously makes my alpha testers using the release .apk unable to have more access to the google apis implemented in the app . For example, the user is no longer able to log into the app via Google Sign In. And again, when I have just uploaded the update to the PLay Store, I return the SHA-1 key to the release .apk and everything works again for my alpha testers .

I know there must be a way around this, but by being new to Android I'm not sure how. I would like some light from the more experienced crew. Thanks =)

    
asked by anonymous 11.07.2016 / 17:17

1 answer

3

When I go to work with some signed Api I usually generate the% signed debug%, so I will only have a .apk .

To do this, put your SHA-1 at the root in your Project (at the same level as the app folder).

In your% of (of the module)% add the following:

android {
    signingConfigs {
        deployer{
            keyAlias KEY_ALIAS
            keyPassword KEY_PASSWORD
            storeFile file(STORE_FILE)
            storePassword STORE_PASSWORD
        }

    }
    buildTypes {
        release {
            …
            signingConfig signingConfigs.deployer
        }
        debug {
            signingConfig signingConfigs.deployer
        }
   }
 …
}

In the grid.propeties file add:

    STORE_FILE=../nomeDoArquivo.keystore
    STORE_PASSWORD=senhaDoStore
    KEY_ALIAS=seuAlias
    KEY_PASSWORD=suaSenhadoAlias

With this, your% degub% will always be signed!

To learn more, follow the documentation !

    
11.07.2016 / 20:04