Gradle build errors with Android Studio

When I try to build my project in Android Studio I get the following error, using the gradle plugin provided with the download (v 1.6):

The specified Gradle installation is not supported by this tooling API version (1.6, protocol version 4)

When I downgrade to gradle 1.3, 1.4 or 1.5, I get this error:

Gradle: : java.lang.ClassNotFoundException: org.gradle.tooling.provider.model.ToolingModelBuilderRegistry

The project was originally created in Eclipse, the exported using the build gradle file option, then imported into Android Studio.

Does anyone know what I can do to fix these issues? Many thanks.

Gradle build errors after updating Android Studio

I just updated Android Studio, and now when I try to build my app, I get the following Gradle error: Information: Compilation completed with 2 errors and 0 warnings in 28 sec Information: 2 errors In

Android Gradle Build Errors

I am getting errors building my Libgdx project with gradle. the android version is broken, but desktop works fine. I have all jars setup in build.gradle as well. It does successfully clean and build t

Gradle errors in Android Studio

I imported an Android project from Eclipse to Andriod Studio, but when I compile, I get these errors. What do they mean? Gradle: : org.gradle.api.plugins.PluginInstantiationException: Could not creat

Android Studio / Gradle Build questions

I’m slowly starting to port my existing apps to Android Studio and Gradle. I have a few questions about it though before I get too far. Is it possible to build a signed apk outside of Android Studio,

Gradle build fails in Android Studio

I am using Android Studio and created a new project, which created the standard Hello world mock. My gradle.build file has the following contents: apply plugin: ‘com.android.application’ android { c

Android Studio 0.4.2 gradle build error

I’m getting an error today when I try to build in Android Studio: 11:32:11 AM Gradle ‘…’ project refresh failed: Cause: com.android.sdklib.SdkManager.createManager(Ljava/lang/String;Lcom/android/uti

Android Studio and Gradle build error

I’ve been using the new preview of android studio and really like it. But recently my project won’t build. I get the following error: Gradle: FAILURE: Build failed with an exception. * What went wrong

Android studio how build all gradle buildTypes

I have four entries in buildTypes. It’s working fine, I can trigger gradle build command on linux terminal, in project dir, 8 apk files are created etc. In android studio I can switch between build va

Android studio Gradle build speed up

Since the last update (Build from june 25) any changes in the Android studio Gradle is painfuy slow. And it also seem to autotrack changes when you edit the file and seem to recompile on keyup. Each

Android Studio is not using gradle to build my projects

I imported a project from Eclipse and android studio is not using my gradle scripts to build the project. Anyone else having this issue? Is there anyway to force Android Studio to use gradle to build

Answers

I think the problem is with the way Eclipse 22 exports the project. In the end the way I got my project transferred over was to create a new project in Android Studio and copy over the files from my Eclipse project into the appropriate directories in the new project.

The directory structure of projects in Android Studio is very different to the structure in Eclipse, and there are several files created when you start a new project which you don’t get when importing a project from Eclipse (e.g. gradlew.bat, settings.gradle).

I had a similar problem and I believe that it was caused by having multiple versions of gradle on my machine. The solution I found was to use the script that Android Studio creates in your project folder (either gradlew (MacOs/Unix) or gradlew.bat (Windows)):

./gradlew assemble

This causes the correct version of gradle to be run – i.e. the version that was shipped with Android Studio.

I haven’t tried creating a project within Eclipse, so I’m not sure if these scripts are created when creating your project in that way.

I also had this problem which can indeed be worked around with Mark’s suggestion of using ./gradlew assemble.

However, this does not help you run Make Project from within Android Studio.

To do that, I had to go to Preferences / Gradle / Use local gradle distribution

and select any random (but NOT gradle) folder inside the project folder.

You might notice that this is marked as an invalid location, but you can ignore that, it seems…

Not a great solution, but it works.