Gradle Support

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
apply plugin: 'com.google.gms.google-services'

Hi Admin,

Im not sure can this be run in current element silver using gradle? I try running this code, but I got error “no repositories are defined”. Could you advise how do I include google services using gradle in silver android?

Thank You.

Best Regards,
Lim

you’ll want your .gradle file to just include the dependencies section. e.g. here’s one from one of my apps that works:

dependencies {
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.google.android.gms:play-services-maps:9.2.1'
    compile 'com.google.android.gms:play-services-gcm:9.2.1'
    //compile 'com.facebook.android:facebook-android-sdk:[4,5)'

    compile('com.amazonaws:aws-android-sdk-core:2.2.18')
    compile('com.amazonaws:aws-android-sdk-cognito:2.2.18')
    compile('com.amazonaws:aws-android-sdk-s3:2.2.18')
    compile('com.amazonaws:aws-android-sdk-mobileanalytics:2.2.18')
    compile('com.amazonaws:aws-android-sdk-sns:2.2.18')
    //compile 'com.facebook.android:facebook-android-sdk:4.6.0'
}

the Elements build chain for Android will add all the rest. If you provide more stuff yourself, you have to provide the full shebang, e.g.:

apply plugin: 'base' 
// Add your dependencies below
repositories {
    def androidHome = System.getenv("ANDROID_HOME")
    maven { url ""$androidHome/extras/android/m2repository/"" }
    maven { url ""$androidHome/extras/google/m2repository/"" }
    jcenter()
    mavenCentral()
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.google.android.gms:play-services-maps:9.2.1'
    compile 'com.google.android.gms:play-services-gcm:9.2.1'
    //compile 'com.facebook.android:facebook-android-sdk:[4,5)'

    compile('com.amazonaws:aws-android-sdk-core:2.2.18')
    compile('com.amazonaws:aws-android-sdk-cognito:2.2.18')
    compile('com.amazonaws:aws-android-sdk-s3:2.2.18')
    compile('com.amazonaws:aws-android-sdk-mobileanalytics:2.2.18')
    compile('com.amazonaws:aws-android-sdk-sns:2.2.18')
    //compile 'com.facebook.android:facebook-android-sdk:4.6.0'
}