简体   繁体   中英

Generating a LibGdx project into android studio version 1.0?

I followed the instructions on here http://www.programmingmoney.com/setup-libgdx-android-studio/ for installing and using LibGdx on Android Studio 1.0(official release). I am on step 4, the actual generation step. When I tried import project, I got this exception

Gradle version 2.1 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\chris\AndroidStudioProjects\SetUpGame\gradle\wrapper\gradle-wrapper.properties to gradle-2.1-all.zip.

This was a similar error to what this person got in this thread - Upgrading project to Android Studio 1.0 (Gradle problems) .

When i went to view gradle-wrapper.properties with notepad ++, this was what i saw

distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip

which meant that this didn't have to be changed. (the answer that was given in the other thread)

Does anyone know what the issue is? Is Android studio version 1.0 too new for Libgdx? I m not that familiar with Gradle.

Look through all your build.gradle files and update the version of the Android Gradle plugin that's specified. If you see buildscript --> dependencies blocks, update them to version 1.0.0 of the Android Gradle plugin like so:

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

I think there may be a bug where if you have the wrong version of the plugin, it gives you a bogus error about having the wrong version of Gradle, and you get ping-ponging error messages when you change it back and forth because it's not fixing the root cause of the error, which is this different version number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM