Gradle | Android

It is sometimes very difficult to debug your app if the settings in gradle are incorrect. You can find a sample of the latest gradle settings that I am using for your reference.


build.gradle (Project: xyz)
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (Module: App)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.xxxxx.xxxx"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.facebook.android:facebook-android-sdk:4.+'  // For Facebook
    implementation 'com.facebook.android:account-kit-sdk:4.+' // For Account Kit
    implementation 'com.android.volley:volley:1.1.0' // For Volley
    implementation 'com.google.android.gms:play-services-ads:17.2.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}