Building projects in Android Studio on OSX Mavericks 10.9.5 (at least with 0.8.9, 0.8.10 and 0.8.11 versions) is currently broken for me. Trying to compile any project (I test with a new project created from the IDE wizard) with the new version of Android Gradle plug-in gives me the following error:
I can build a project with a single activity created from the wizard in Android Studio 0.8.9 with Gradle 2.1. Which version of the Gradle Android plugin are you using? I believe that you’ll need to bump it to at least 0.13.0 - I tried the latest release which is 0.13.2 and it worked fine with Gradle 2.1.
The plugin version can be set wither in the build.gradle file (the line with ‘classpath ‘com.android.tools.build:gradle:xxx’’ or by editing the project settings - the Android Plugin Version is a property in there.
If none of that works, we’ll need to see some more detail of the error, and maybe an explanation of exactly what you’re doing when trying to build it.
This is an issue I had when trying to setup a new development machine. I’ve done a bunch of tests, and my findings are the following:
-The Android Studio version doesn’t seem to matter: I’ve tried with 0.8.9 from the beta channel and with 0.8.10 and 0.8.11 from the canary one. All do the same.
-I’ve stopped trying with my actual project and I’m doing tests with a blank one, created this way…
File / New Project Leave default values and Next Check Phone and Tablet, minimum API 15 Select Navigation Drawer Activity and Next Leave default values and Finish
If I use Gradle Android plugin 0.12.2 or 0.12.+, it tries to build with Gradle 1.12 and I get a diferent error…
Error:FAILURE: Build failed with an exception.
What went wrong: Task ‘’ not found in root project ‘MyApplication’.
Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
…and this line in my log:
Unable to load class ‘org.gradle.tooling.internal.consumer.connection.ActionAwareConsumerConnection$BuildActionAdapter’
If I use 0.13.0 or 0.13.+, it builds with Gradle 2.1 and gives the error I wrote in my original post.
Do you get the same error when running Gradle from the command line? It looks like Android Studio is starting Gradle without specifying any tasks, or specifying an empty task name, which would be a bug in Android Studio, but it might help if you could run Gradle from the command line so that we could rule out any bugs inside Gradle itself.
You were right! I did this new test with Gradle 2.1 and found that, while gradlew was not executable, once I realized it was the build script and did a chmod +ox, build was successful.