0

I am currently trying to learn how to use Google services apk, and tried one of their samples called Buttonclicker where i can learn how to use their multiplayer apk.

However after following all the instructions, i got the error,

Gradle sync failed: Gradle DSL method not found: 'compile()'
            Consult IDE log for more details (Help | Show Log)

I have tried looking at similar stackoverflow pages but i cant seem to find any solution to it.

I suspect this has to do with the gradle but i am not sure where i have gone wrong

This happenned after i have generated my apk, and i headed on to try to get the signing done whereby i set the build types to release after doing all the required steps.

Gradle file

Gradle file Code

buildscript {
repositories {
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
}
}

allprojects {
repositories {
    jcenter()
}

ext {
    android_compile_version = 23
    android_version = '23.0.1'
    android_min_sdk_version = 9

    appcompat_library_version = '23.0.1'
    support_library_version = '23.0.1'
    gms_library_version = '8.1.0'
}
}

Base Game Util code:

apply plugin: 'com.android.library'


buildscript {
repositories {
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
}
}

dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
    ext.appcompat_library_version = '20.0.+'
}
if (!project.hasProperty('support_library_version')) {
    ext.support_library_version = '20.0.+'
}
if (!project.hasProperty('gms_library_version')) {
    ext.gms_library_version = '8.1.0'
}

compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}

android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
    ext.android_compile_version = 23
}
if (!project.hasProperty('android_version')) {
    ext.android_version = '23'
}

compileSdkVersion android_compile_version
buildToolsVersion android_version
}

Button Clicker code

apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        keyAlias 'ryan1k'
        keyPassword 'ryan11'
        storeFile file('C:/Users/Nayr/Desktop/ryan1.jks')
        storePassword 'ryan11'
    }
}
compileSdkVersion android_compile_version
buildToolsVersion android_version
defaultConfig {
    minSdkVersion android_min_sdk_version
    targetSdkVersion android_compile_version
    versionCode 1
    versionName "1.0"
}
lintOptions {
    abortOnError false
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),      'proguard-rules.txt'
        signingConfig signingConfigs.config
    }
}
}

dependencies {
compile "com.android.support:appcompat-v7:${appcompat_library_version}" compile "com.android.support:support-v4:${support_library_version}" compile project(':libraries:BaseGameUtils')
}

buildscript {
repositories {
    jcenter()
}
}
Nayr L
  • 11
  • 8

0 Answers0