Skip to content

Instantly share code, notes, and snippets.

@hitesh-dhamshaniya
Created June 5, 2019 04:49
Show Gist options
  • Select an option

  • Save hitesh-dhamshaniya/32e0e16472dd44c9629bc97fbb3598af to your computer and use it in GitHub Desktop.

Select an option

Save hitesh-dhamshaniya/32e0e16472dd44c9629bc97fbb3598af to your computer and use it in GitHub Desktop.
Common Gradle we need to every project in Android. Script added to make meaning full name of apk file.
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.devdigital.devcomm"
minSdkVersion 19
targetSdkVersion 28
versionCode 42 //Release on 30 April 2019
versionName "5.8"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
buildConfigField "String", "API_AUTH_CREDENTIAL", "\"TEST@1234\""
buildConfigField "String", "ANY_STRING", "\"ANYSTRING\""
buildConfigField "String", "SAVE_PSWD", "\"\""
resValue "string", "encryption_key", "E12"
//Remove the localized resources which are not needed by using resConfigs.
//As all the support libraries may have localized folders for the other languages which we don’t need.
resConfigs "en"
}
signingConfigs {
release {
storeFile file(System.getenv("ANDROID_APP_PRIVATE_KEY")) // Set it in enviornment variable
keyAlias System.getenv("ANDROID_APP_ALIAS")
storePassword System.getenv("ANDROID_KEY_STORE_PW")
keyPassword System.getenv("ANDROID_ALIAS_STORE_PW")
}
}
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
variant.outputs.all {
outputFileName = 'AppNAme'
outputFileName += "-v" + variant.versionName + "-" + new Date().format('Mddyyyy')
outputFileName += "-" + variant.buildType.name
outputFileName += ".apk"
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix ".debug"
//Staging
buildConfigField "String", "API_SERVER_URL", "\"http://index.php/\""
//Live
//buildConfigField "String", "API_SERVER_URL", "\"https://....index.php\""
//Used in manifest
manifestPlaceholders = [crashlyticsEnabled: true]
}
staging {
applicationIdSuffix ".staging"
versionNameSuffix ".staging"
debuggable = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "String", "API_SERVER_URL", "\"https://domainname/index.php\""
//Used in manifest
manifestPlaceholders = [crashlyticsEnabled: false]
}
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "String", "API_SERVER_URL", "\"https://domain/index.php\""
//Used in manifest
manifestPlaceholders = [crashlyticsEnabled: true]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
configurations {
all {
exclude module: 'httpclient'
}
}
/*dexOptions {
javaMaxHeapSize "4g"
}
sourceSets {
main {
//Define resource directory
res.srcDirs = ['src/main/res']
}
}*/
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
/* Test Library*/
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
/* Support Library*/
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata:2.0.0'
/* Firebase */
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-appindexing:17.1.0'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
implementation 'com.google.firebase:firebase-perf:16.2.5'
implementation 'com.google.firebase:firebase-config:16.5.0'
/*Crashlytics*/
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
/*Google Auth*/
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude module: 'guava-jdk5'
}
implementation('com.google.http-client:google-http-client-jackson2:1.24.1') {
exclude module: 'guava-jdk5'
}
/*Google Calendar*/
implementation('com.google.apis:google-api-services-calendar:v3-rev331-1.24.1') {
exclude module: 'guava-jdk5'
}
/*Google Sheet*/
implementation('com.google.apis:google-api-services-sheets:v4-rev516-1.23.0') {
exclude module: 'guava-jdk5'
}
/* Glide */
implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
/*3rd Party Gradles*/
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.ganfra:material-spinner:2.0.0'
implementation 'com.airbnb.android:lottie:2.8.0'
implementation 'com.devdigital:customtabs:1.5.1'
/*Room Libraries*/
implementation 'androidx.room:room-runtime:2.1.0-alpha06'
implementation 'androidx.room:room-common:2.1.0-alpha06'
kapt 'androidx.room:room-compiler:2.1.0-alpha06'
/*Work Manager*/
implementation('androidx.work:work-runtime:2.0.1') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
/*Custom Fonts*/
implementation 'io.github.inflationx:calligraphy3:3.1.0'
implementation 'io.github.inflationx:viewpump:1.0.0'
implementation 'com.facebook.shimmer:shimmer:0.3.0'
implementation 'gun0912.ted:tedpermission:2.2.2'
// Logger
implementation 'com.orhanobut:logger:2.2.0'
/** Networking lib Start */
//Network Lib
implementation 'com.devdigital:networklib:2.0.17-beta'
//Networking
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
//Json Lib
implementation 'com.google.code.gson:gson:2.8.5'
//okhttp3
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
//stetho
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
/** Networking lib End */
//Alternative of Local broadcast manager
implementation 'org.greenrobot:eventbus:3.1.1'
//For Contact/Skills/Department Chip Alignment
implementation 'com.google.android:flexbox:1.1.0'
//For Sticky Header in TimeCard
implementation 'org.zakariya.stickyheaders:stickyheaders:0.7.6'
//Fast Scrolling for contact listing
implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
implementation 'com.github.arimorty:floatingsearchview:2.1.1'
//Create Badge from Number
implementation 'com.github.nekocode:Badge:2.0'
//Required by "clapfab-release.aar"
implementation 'com.github.florent37:viewanimator:1.0.5'
//parse xml quote
implementation 'org.jsoup:jsoup:1.8.3' // required
//Run Web-Server on Android app
implementation 'org.nanohttpd:nanohttpd:2.3.1'
// Gallery Lib
//implementation 'com.devdigital:gallerylib:1.2'
implementation 'com.github.dhaval2404:imagepicker:1.1'
// local date
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.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