Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio don't recognise signing configuration declared in a properties file

I have the following key store info store in keystore.properties in root folder

storePassword=******
keyPassword=******
keyAlias=******
storeFile=/home/jerry/jerryKeyStore 

and the following gradle code to load it

// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}

When I open the signing tab of project structure window, Android Studio reads Unrecognized value in all signing fields. It also can't install the APK on my device, throwing an error that APK was built with different key.. as I built it with signing info written directly into the gradle file

I use the following
Android Studio: 2.1.2
Gradle: 2.1.0

like image 407
Shady Atef Avatar asked Jun 10 '16 20:06

Shady Atef


1 Answers

Make sure you have:

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

in module.

like image 166
Roman Spurdo Avatar answered Oct 23 '22 21:10

Roman Spurdo