password You need to define the app when you do the version release build.gradle
signingConfigs
. You should avoid the following at this point:
don't do this . This will appear in version control.
Signingconfigs { release { storefile file ("Myapp.keystore") "password123" "thekey " "password789" }}
Instead, create a file that does not join the version control system gradle.properties
.
keystore_password=Password123key_password=password789
The file is automatically introduced by Gradle, which you can buld.gradle
use in the file, for example:
Signingconfigs { release { try { storefile file ("Myapp.keystore") Storepassword keystore_password "Thekey" keypassword key_password } catch (ex) { thrownew invaliduserdataexception ("You should define Keystore_ PASSWORD and Key_password in Gradle.properties. " ) } }}
A complete example:
Apply plugin: ' Com.android.application 'Android {compilesdkversion22buildtoolsversion"22.0.1"Defaultconfig {ApplicationID"Com.example.jack.umengfeedback"minsdkversion15targetsdkversion22Versioncode1Versionname"1.0"} signingconfigs {release {Try{storefile file ("Myapp.keystore") Storepassword Keystore_password Keyalias"Thekey"Keypassword Key_password}Catch(ex) {Throw NewInvaliduserdataexception ("should define Keystore_password and Key_password in Gradle.properties."))}}} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}}repositories {flatdir {dirs' Libs '//This is the we can find the. aar file in Libs folder}}dependencies {Compile filetree (dir:' Libs ', include: [' *.jar ']) Compile' com.android.support:appcompat-v7:22.1.1 'Compile project (': Umenglib ') //Dependent AARCompile (name: ' Kalelibrary ', ext: ' AAR '))}
When building with Gradle, keep sensitive information, such as passwords, out of Build.gradle