Android: Fix Missing Gradle 2.2.0 Dependencies

Over the weekend, Google removed version 2.2.0 of their gradle build tools from the standard repositories. However, 2.2.0 is the version of gradle GameMaker Studio uses to build your Android apps. Accordingly, you builds will now fail with the following error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project ''.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find any version that matches com.android.tools.build:gradle:2.2.0+.
     Versions that do not match:
         2.3.0
         2.1.3
         2.1.2
         2.1.0
         2.0.0
         + 71 more
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
         https://jcenter.bintray.com/com/android/tools/build/gradle/
         https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Assuming Google does not simply put the files back in the near-future, a coming runtime update to GameMaker Studio 2 will resolve this issue by doing the steps we're about to cover in this FAQ, but while we wait for confirmation from Google you can fix things to get your apps building again just now by doing the following:

  • Open your GMS2 runtime cache directory. On Windows, the default location for this is "%ProgramData%\GameMakerStudio2\Cache\runtimes" and on macOS this is "/Users/Shared/GameMakerStudio2/Cache/runtimes".

  • Open the directory of your current runtime (e.g., 2.2.1287), and go to the "android\runner\RootFiles" subfolder.

  • Open the build.gradle file inside this folder. It should look like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
  mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0+'
    }
}
allprojects {
    repositories {
  maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
}
  • Add this line to both "repositories" sections, in between maven and jcenter:
maven { 
      url "http://repo.spring.io/plugins-release/"
  }

 

The final build.gradle file should look like this (assuming you had not already customised yours):

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
  mavenCentral()
  maven {
      url "http://repo.spring.io/plugins-release/"
  }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0+'
    }
}
allprojects {
    repositories {
  maven {
            url "https://maven.google.com"
        }
  maven {
      url "http://repo.spring.io/plugins-release/"
  }
        jcenter()
    }
}

 

Relaunch GameMaker Studio, clean the compiler cache (use the "broom" button at the top of the IDE) and then re-build your project. You should find gradle is able to find its files again and so your build succeeds again.

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.