Skip to content

Instantly share code, notes, and snippets.

@oscarcidcoder
Created July 15, 2019 13:57
Show Gist options
  • Save oscarcidcoder/1283f071ccda4fbd5f2c1ccbd3830e05 to your computer and use it in GitHub Desktop.
Save oscarcidcoder/1283f071ccda4fbd5f2c1ccbd3830e05 to your computer and use it in GitHub Desktop.
Gradle General con Signing
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
import groovy.swing.SwingBuilder
def keyPropertiesFile = rootProject.file("key.properties");
if (keyPropertiesFile == null || !keyPropertiesFile.exists()) {
throw new GradleException("key.properties file is missing that contains Pilgrim Keys.");
}
def keyProperties = new Properties();
keyProperties.load(new FileInputStream(keyPropertiesFile));
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(':app:assembleRelease')) {
def keyPassword = null
def keyAlias = null
try {
keyAlias = KEYSTORE_ALIAS
keyPassword = KEYSTORE_PASSWORD
} catch (err) {
}
if ((keyPassword == null || keyAlias == null)
|| (keyAlias.size() == 0 || keyPassword.size() == 0)) {
if (System.console() == null) {
new SwingBuilder().edt {
dialog(modal: true,
title: "Alias de la KeyStore: ",
alwaysOnTop: true,
resizable: false,
locationRelativeTo: null,
pack: true,
show: true
) {
vbox {
label(text: "Por favor introduzca el Alias: ")
input = textField()
button(defaultButton: true, text: 'OK', actionPerformed: {
keyAlias = input.text;
dispose();
dialog(modal: true,
title: "Password de la KeyStore: ",
alwaysOnTop: true,
resizable: false,
locationRelativeTo: null,
pack: true,
show: true
) {
vbox {
label(text: "Por favor introduzca el Password: ")
input = passwordField()
button(defaultButton: true, text: 'OK', actionPerformed: {
keyPassword = input.password;
dispose();
})
}
}
})
}
}
}
} else {
keyAlias = System.console().readLine("\n Introduzca el Alias de la KeyStore: ")
keyAlias = new String(keyAlias)
keyPassword = System.console().readPassword("\n Introduzca la clave de la KeyStore: ")
keyPassword = new String(keyPassword)
}
if (keyAlias.size() == 0 || keyPassword.size() == 0) {
throw new InvalidUserDataException("Key Password o Key Alias estan vacias");
}
}
android.signingConfigs.release.keyAlias = keyAlias
android.signingConfigs.release.keyPassword = keyPassword
android.signingConfigs.release.storePassword = keyPassword
}
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
lintOptions {
checkReleaseBuilds false
abortOnError false
}
defaultConfig {
applicationId "AppID"
minSdkVersion 19
targetSdkVersion 27
versionCode 00
versionName "VersionName"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true //important
buildConfigField "String", "CLIENT_SECRETPILGRIM", keyProperties['SECRET_KEY']
buildConfigField "String", "CLIENT_ID", keyProperties['CLIEND_ID']
buildConfigField "int", "SUPPORT_ID", keyProperties['USER_SUPPORT_ID']
resValue "string", "APP_KEY", keyProperties['APP_KEY']
resValue "string", "FACEBOOK_APP_ID", keyProperties['FACEBOOK_APP_ID']
resValue "string", "FACEBOOK_PROVIDER", keyProperties['FACEBOOK_PROVIDER_AUTHORITIES']
resValue "string", "FACEBOOK_PROTOCOL_SCHEME", keyProperties['FACEBOOK_PROTOCOL_SCHEME']
}
signingConfigs {
release {
try {
keyAlias ''
keyPassword ''
storeFile file('C:/Users/oscarcid/Documents/KeyStore/keystore.jks')
storePassword ''
} catch (ex) {
throw new InvalidUserDataException("You should define KEYSTORE_PASSWORD and KEY_ALIAS")
}
}
}
buildTypes {
release {
resValue "string", "GOOGLE_MAPS_API_KEY", keyProperties['GOOGLE_MAPS_APP_KEY_PRO']
buildConfigField "String", "CLIENT_REST_", keyProperties['CONNECTION_REST_URL_PRO']
//QB
buildConfigField "String", "QB_APP_ID", keyProperties['QB_app_id_pro']
buildConfigField "String", "QB_AUTH_KEY", keyProperties['QB_auth_key_pro']
buildConfigField "String", "QB_AUTH_SECRET", keyProperties['QB_auth_secret_pro']
buildConfigField "String", "QB_ACC_KEY", keyProperties['QB_account_key_pro']
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
buildConfigField "String", "CLIENT_REST_PILGRIM", keyProperties['CONNECTION_REST_URL']
resValue "string", "GOOGLE_MAPS_API_KEY", keyProperties['GOOGLE_MAPS_APP_KEY']
//QB
buildConfigField "String", "QB_APP_ID", keyProperties['QB_app_id']
buildConfigField "String", "QB_AUTH_KEY", keyProperties['QB_auth_key']
buildConfigField "String", "QB_AUTH_SECRET", keyProperties['QB_auth_secret']
buildConfigField "String", "QB_ACC_KEY", keyProperties['QB_account_key']
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "3g" // 2g should be also OK
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':getbconlibrary')
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.bumptech.glide:glide:4.6.1'
compile 'com.android.volley:volley:1.1.1'
compile 'com.facebook.android:facebook-android-sdk:[5,6)'
compile 'com.android.support:support-vector-drawable:27.1.0'
compile 'com.google.android.gms:play-services:12.0.1'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.5'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.github.f0ris.sweetalert:library:1.5.3'
compile 'com.android.support:support-compat:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-messaging:12.0.1'
compile 'com.google.firebase:firebase-config:12.0.1'
compile 'com.google.android.gms:play-services-tagmanager:12.0.1'
compile 'com.google.android:flexbox:1.0.0'
//Architecture Components
// ViewModel and LiveData
//compile "android.arch.lifecycle:extensions:1.1.1"
//compile "android.arch.lifecycle:runtime:1.1.1"
//annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
//Room
compile 'android.arch.persistence.room:runtime:1.1.0-beta1'
compile 'android.arch.persistence.room:rxjava2:1.1.0-beta1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.0-beta1"
//Tap Target View explicacion de interfaz
compile 'com.getkeepsafe.taptargetview:taptargetview:1.12.0'
//RxJava | RxAndroid
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
//Crashlytics
compile 'com.crashlytics.sdk.android:crashlytics:2.9.9'
//QuickBox SDK
compile 'com.quickblox:quickblox-android-sdk-chat:3.9.0'
compile 'com.quickblox:quickblox-android-sdk-content:3.9.0'
compile 'com.otaliastudios:zoomlayout:1.3.0'
}
apply plugin: 'com.google.gms.google-services'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment