I've updated my Android Studio into version 0.3.2. but I'm having a problem about my project and it gives me this error:
I only have a bit of idea on whats happening on this so I tried to press F4 (Windows) then 'Module' and then the TabFragmentExercise then tried to change the 'Paths' and selected the 'Use module compile path' just like on how the default project does and changed into this:
C:\Users\PCNAME\AndroidStudioProjects\TabFragmentExerciseProject\TabFragmentExercise \build\classes\debug
Then rebuild the project but still no chance. It will just give me this result:
Local path doesn't exist.
Here's my config for gradle anyways:
gradle-wrapper.properties
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}
dependencies {
compile files('libs/android-support-v4.jar', 'libs/commons-io-2.4.jar', 'libs/apache-mime4j-0.6.1.jar', 'libs/httpclient-4.1.jar', 'libs/httpcore-4.1.jar', 'libs/httpmime-4.1.jar')
}
Hope someone can help me on this.
So after searching I found out the solution for this. First the problem that the "APK path is not specified for module "ProjectName" really means that the path was not configured correctly upon importing on your project. What you can do is do the steps I've done above but instead of that path locate your apk instead.
Now after doing it when you clean the app and tried to run it you will now encounter an error saying that the "Local path doesn't exists". when that happens go to your .iml file then just configure the path by adding this lines under the facet->configuration:
<option name="APK_PATH" value="/build/apk/YourProject.apk" />
Rebuild project then run. It works like magic indeed.
Try doing a ./gradlew clean, then go to Tools -> Android -> Sync Project with Gradle Files
If that doesn't work, then delete all your *.iml files and re-import the project. This process should only take a couple minutes if you're importing from a Gradle project
Related
I've recently updated the gradle version of my project from 2.14.1 to 3.0. Since then the gradle build is failing every time with this error:
Error:Cause: org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I've searched google and found some solutions like this one but nothing is working. Does anyone know how to fix it?
Upgrade your gradle build tools to the latest version.
One easy way to do this is to add the latest version of the build tools as a dependency in your build.gradle file, for example:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta1'
}
You can then run gradle tasks and gradle will download everything you need.
After Android Studio 2.2 stable released on Sep 19 2016 , the latest version of the build tools is 2.2.0 . So you can fix it by :
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
As Android Studio 2.4 stable is not ready to release yet (May 4 2017), the latest stable version of build tools is 2.3.1 .
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
If you update this build tools version to 2.3.* , you should also update gradle wrapper version to 3.3 in /yourProjectRoot/gradle/wrapper/gradle-wrapper.properties file. (i know it is not matching question Gradle build failing after update to 3.0, but i strongly suggest you to use latest build tool as google recommended)
BTW: version 2.3.1 of build tool is only exist on jCenter, not MavenCentral, so if you run into error below when run gradlew command line in terminal
Could not find com.android.tools.build:gradle:2.3.1.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.3.1/gradle-2.3.1.jar
just replace mavenCentral() with jcenter() like
repositories {
jcenter()
//mavenCentral()
}
For latest update of Android Studio 3.0
In gradle-wrapper.properties(File Name) change URL of distributionUrl to the following:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you use gradle plugin 2.1.3,
It's simple to solve:
update your gradle plugin to version 2.2.0-beta1
Notes: this is a beta version, maybe you can get any other issues.
https://discuss.gradle.org/t/classcastexception-in-gradle-nightly-3-0-20160609/17979
Happy coding :)
Okay I got it working. For anyone facing the same problem the way it worked for me is as follows:
Go to your external .gradle folder (for me it was C:\Users\drilon.gradle). Inside caches and daemon folder delete all the version folder (they look like this "2.14.1", or "3.0"). Also go to wrapper -> dists -> delete everything there.
Inside your project root (for me it was C:\Users\drilon\AndroidStudioProjects\PorjectName) go to the .gradle folder and delete everything there.
Rebuild the project
EDIT:
Turns out this solution was setting the gradle version back to 2.14.1. ending0421's solution is the working one.
For latest update of Android Studio 3.3.1 below code work.
1) gradle-wrapper.properties add below line.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
2)build.gradle in project level add below classpath
dependencies
{
classpath 'com.android.tools.build:gradle:3.1.0'
}
if your gradle version is: 3.0.1 then use below code in your gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
if 3.1.2 then use below code in your gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
After 1 hour R&D No Solution as worked for me...
But still i have solution follow this its work 100%
step 1: upgrade your build.gradle(Project:<your project name>)
Example : classpath 'com.android.tools.build:gradle:2.1.3' // old gradle file
classpath 'com.android.tools.build:gradle:2.3.1' // upgraded file
OR
classpath 'com.android.tools.build:gradle:3.1.0'
Step 2 : Upgrade compileSdkVersion buildToolsVersion
Example : compileSdkVersion 23 buildToolsVersion "23.0.3 // old api's
compileSdkVersion 25 buildToolsVersion "25.0.2" // upgraded api's
Step 3: upgrade gradle-wrapper.properties
Example : distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip // old or any version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // new or any version
Step 4 : finally goto build>rebuild project...
Still You face some problem commit or inbox me....
......End #Ambilpura
You should check your Gradle Plugin version and Gradle version before updating.
Check Gradle Plugin Version in your project level build.gradle file-
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:gradle.plugin.version'
}
}
Check Gradle Version in your gradle-wrapper.properties-
distributionUrl=https\://services.gradle.org/distributions/gradle-gradle.version.zip
At the time of this answer, below were the latest versions. You can match your versions on this page.
Simply delete everything inside gradle folder in main project folder and Rebuild the
project. It will start working.
If your gradle plugin 3.0.0 for studio version 3.0, Add this in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
simple answer try this...
goto build.gradle(PROJECT) and check the gradle version as shown below
'com.android.tools.build:gradle:2.1.3' or 3.0 or 3.1 or xx.xx
now open gradle-wrapper.properties see this line of code if gradle version is 2.x this the code below...
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
gradle-2.14.1-all.zip line of code must be same as gradle version
example:
example:
mine is 2.x so...
classpath 'com.android.tools.build:gradle:2.1.3' in build.gradle so
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
in gradle-wrapper.properties.
if gradle version is 3.x then
classpath 'com.android.tools.build:gradle:3.1.0' in build.gradle then
distributionUrl=https://services.gradle.org/distributions/gradle-3.14.1-all.zip
in gradle-wrapper.properties.
check this it will works
if Android Studio Android Studio 3.0 below code work.
gradle-wrapper.properties add below line.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
if Android Studio Android Studio 3.1.2 below code work.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
if Android Studio 3.3.1 below code work.
1) gradle-wrapper.properties add below line.
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
2) build.gradle in project level add below
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
Android Gradle dependencies are not working in new update of Android
Studio
Most important thing if you are face a lot of problems :
It is applicable on plugin 7.1 or new update version
Please Try this:
Go To -> settings.gradle inside of repositories { } :
add two files as :
maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
maven { url "https://jitpack.io" }
The complete structure in
settings.gradle
file as given below :
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven{ url("https://repo.gradle.org/gradle/libs-releases/") }
maven { url "https://jitpack.io" }
}
}
rootProject.name = "MyApp"
include ':app'
And last step, it is must be added into gradle.properties files.
android.useAndroidX=true
android.enableJetifier=true
I have recently updated android studio to the latest version,but then comes the problem.
Gradle 'MyApplication' project refresh failed.
Error:Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip'.
Found this in StackOverflow
However trying everything nothing works - cannot create new project of import anything at the moment.Please kindly advice.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.sclick.myapplication"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
task assemble{}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
**Top Level Gradle.build**
// Top-level build file where you can add configuration options common to all
sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
gradle-wrapper.properties
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
I had same issue. I have tried many things but nothing worked Until I try following:
Close Android Studio
Delete any directory matching gradle-[version]-all within C:\Users\<username>\.gradle\wrapper\dists\. If you encounter a "File in use" error (or similar), terminate any running Java executables.
Open Android Studio as Administrator.
Try to sync project files.
If the above does not work, try restarting your computer and/or delete the project's .gradle directory.
Open the problem project and trigger a Gradle sync.
I had a similar issue, when I upgraded to the latest version of Android Studio 1.3.2. What seemed to work for me was removing the .gradle folder from my project directory:
rm -rf ~/project/.gradle
I had same issue when first start Android Studio in Window 10, with java jdk 1.8.0_66. The solution that worked is:
Step 1: Close Android Studio
Step 2: Delete Folder C:\Users\Anna\.gradle
(Anna is my username)
Step 3: Open Android Studio as Administrator
Step 4: If you are currently in an opened project, close current project by select File > Close Project.
Step 5: Now you seeing this Quick Start GUI:
Select Open an existing Android Studio project, navigate to your project folder and select it.
Wait for gradle to build again (it would download all the dependency in your build.gradle for every module in your project)
If it has not worked till now, you could restart your computer. Do step 1 again.
This happens sometime when I changed Android Studio version or recently upgrade Window. Hope that helps !
I forced to use a proxy and also forced to add proxy setting on gradle.properties as these:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
And also forced to close and open studio64.exe as administrator .
Now its all seems greate
Event log says
8:21:39 AM Platform and Plugin Updates: The following components are ready to update: Android Support Repository, Google Repository, Intel x86 Emulator Accelerator (HAXM installer), Android SDK Platform-Tools 24, Google APIs Intel x86 Atom System Image, Android SDK Tools 25.1.7
8:21:40 AM Gradle sync started
8:22:03 AM Gradle sync completed
8:22:04 AM Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar]
8:22:25 AM Gradle build finished in 21s 607ms
I'm using android studio 2.1.2 downloaded as exe setup file. it has its Gradle ( I also forced to use custom install to address the Gradle )
Go on Project->Settings->Compiler(Gradle-based android project), find the text field "VM option" and put there:
-Xmx512m -XX:MaxPermSize=512m
This shouls solve the issue in any case the error shown in the gradle message window is "Could not reserve enough space for object heap"
Hope this helps
You can download the gradle you want from Gradle Service by reading the gradle-wrapper.properties.Download it ,unpack it where you like and then change your grandle configuration use local not the recommended.
I had the same problem and I Just Invalidate caches/restart
Try updating gradle dependency to 2.4. For that you need to go to
File -> Project Structure -> Project -> Gradle version.
There you need to change from 2.2.1 to 2.4. Wait for new gradle version to be downloaded.
And you are ready to go.
I have run into a similar problem on Mac.
Looking at the log under Help -> Show logs in Finder I found the following entry.
You have JVM property "https.proxyHost" set to "127.0.0.1".This may lead to incorrect behaviour. Proxy should be set in Settings | HTTP ProxyThis JVM property is old and its usage is not recommended by Oracle.(Note: It could have been assigned by some code dynamically.)
and it turned out I had Charles as a network proxy running. Shutting down Charles solved the problem.
I'm new to android development and I've downloaded Android SDK 4.2 and receiving the error:
Could not execute build using Gradle distribution 'http://services.gradle.org /distributions/gradle-1.9-all.zip'. from the event log
I have tried many of the solutions here for similar error messages:
File - Invalidate Caches/restart - Invalidate and Restart. Then shutting down AS and renaming the .gradle folder in c/users/myname to old.gradle and restarting.
renaming the version number in build.gradle
com.android.tools.build:gradle:0.7.+' to 0.8.+
renaming version in gradle-wrapper.properties services.gradle.org/distributions/gradle-1.9-all.zip to 1.10
uninstalling AS twice.
Some of the solutions I simple don't understand and for those that I do understand it seems I've tried them all.
I read to try another version of gradle 1.9, but don't where to begin. Are there versions like 1.9.1, 1.9.2..etc?
Any help?
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
gradle-wrapper.properties:
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
I had the same problem as described at the top while following a course on Udemy. I was able to run my project on Android, but not Desktop. After messing around a lot, here is the solution that worked for me (n.b. I am a noob, so apologies for the simplicity of my answer:
with Project view (towards upper left, may be set to "Android":
go to gradle>wrapper>gradle-wrapper.properties and change the gradle distribution to "gradle-2.10-all.zip
then go to build.gradle and change "dependencies{classpath..." to "'com.android.tools.build:gradle:2.1.2'"
if you continue to get errors, you may need to return to the build.gradle and delete:
jcenter()
google()
near the top. Finally, ensure you are using the correct path for your assets by going to:
Launcher Options(where you select Android or Desktop deployment)>Edit Configurations
under working directory, set the path to android>assets
Hope this works for you
Had the same problem but what I did was
To go to the Gradle Repo and download the zip file specified in the wrapper.
Paste in the folder C:/User/youraccount/.gradle/wrapper/dist/weirdfoldername/
open the android studio go to File > settings > gradle
Make sure use default gradle wrapper is active and then check offline work
Restart the studio
Worked for me. You should give it a try.
You may also get this error if you are experiencing Internet issues. (In my browser, some webpages worked, some didn't.) Resetting my modem resolved the gradle error for me.
Recently, I uninstalled my SDK from location /Users/Shared/Downloads/adt-bundle-mac-x86_64-20130729/sdk and installed in /usr/local/android_sdk/sdk
and the same changes I made in Android Studio Settings
Configure->Project Default->Project Structure->Platform Settings->SDK
Now, The problem is with these changes I can build any new project but when I open my old project It gives me this error:
Gradle 'GPSProvider' project refresh failed:
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.7-bin.zip'.
Build file '/Users/zohrakhan/AndroidStudioProjects/GPSProvider/GPSProvider/build.gradle' line: 9
A problem occurred evaluating project ':GPSProvider'.
A problem occurred evaluating project ':GPSProvider'.
The SDK directory '/Users/Shared/Downloads/adt-bundle-mac-x86_64-20130729/sdk' does not exist.
Please help me to find out the problem.
Edit 1:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 16
}
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
}
Check local.properties file (in /Users/zohrakhan/AndroidStudioProjects/GPSProvider/GPSProviderdirectory). This file may contain:
sdk.dir=/Users/Shared/Downloads/adt-bundle-mac-x86_64-20130729/sdk
So, just replace sdk.dir property.
If it is an Old project and you were using different sdk that time Do the following before import
Delete all the content of .idea directory inside the project directory
Open Studio and import the project and wait until it sync with gradle.
If it gives gradle version related error while sync, update your build.gradle file with whaever version your error message is suggesting.
Now do mentioned below to update your local.propertiesfile
Sync your project with Gradle it will automatically ask if there are any conflicts in your sdk paths in project .
Choose default project sdk to use from dialog.
This is introduced from Android Studio 0.3.7
I'm trying to create a simple android project with gradle. I work in a computer with Debian GNU/Linux 7 'wheezy'.
I followed the recomendations in Gradle Plugin User Guide - Android Tools Project Site, but it casts an error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/alex/Proyectos/MyLogin/build.gradle' line: 11
* What went wrong:
A problem occurred evaluating root project 'MyLogin'.
> Could not create plugin of type 'AppPlugin'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.817 secs
I followed the specifications:
Gradle 1.9
Plugin 0.7
SDK 17+ (actually 19)
I also started a project anew, and the results I showed were issued by the command gradle tasks as shown in the documentation.
I also tried gradle 1.10, but the result is the same.
Even this question was not usefull, since it solved with 'upgrading' to gradle 1.6 (I understand that plugin 0.7 requires at least gradle 1.9).
I tried this after failing with the same error in android-studio and IntelliJ Idea.
EDIT: I also tried with new projects in both IDEs, and got the same issue. But what most surprises me is that both IDEs use gradle 1.8 in their wrapped form. I tried to cinfigure both of them to use my local gradle install, but still the same issue.
What am I doing wrong? Is it a bug? How can I avoid the problem?
Please, help me.
EDIT: Here is my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 14
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
sourceCompatibility = 1.6
version = '0.1'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
//compile project(':core')
}
Google made a mistake with version 0.7.2 of the Gradle plugin:
Note: 0.7.2 requires Java7. This is a mistake. Use 0.7.3 instead.
Release 0.7.3 re-enables Java6 support. Declaring Gradle 0.7.3 in my build files does indeed resolve this for me.
No one is perfect :)
http://tools.android.com/tech-docs/new-build-system
Use Gradle 1.9 instead of Gradle 1.10. There is an issue with 1.10 : https://code.google.com/p/android/issues/detail?id=63822
Also answered here:
Can't find org.gradle.api.artifacts.result.ResolvedModuleVersionResult when apply Android plugin in Gradle
I got it working using Gradle 1.10 with the Gradle plugin 0.8.0.
// /build.gradle
// Top-level build file where you can add configuration
// options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
...
# /gradle/wrapper/gradle-wrapper.properties.
#Sat Feb 01 20:41:29 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
If you're using the command line to create the project like so:
android create project -g -v 1.2.2 --target 1 --name rtest --path rtest --activity MainActivity --package com.mydomain.rtest
The project is created to use version 1.2.2 of the android-gradle-plugin, but the project is initialised with gradle 1.12, which isn't compatible.
To fix it, do the following:
Open rtest/gradle/wrapper/gradle-wrapper.properties and set distributionUrl to the release you want; for example: http\://services.gradle.org/distributions/gradle-2.2.1-all.zip (don't forget to escape the colon - yes, that makes me smile too);
Open build.gradle and change runProguard false to minifyEnabled false;
./gradlew clean && ./gradlew assembleDebug
I also remove the hidden .gradle folder, but I'm not sure if it's necessary
And it all works again.
For those who are using 2.1 version of studio, replace classpath 'com.android.tools.build:gradle:2.1.0-rc1' with classpath 'com.android.tools.build:gradle:2.1.0'. This solved my problem.
If you are attempting to update your Gradle 1.9 project to Gradle 1.10 using
task wrapper(type: Wrapper) {
gradleVersion = '1.10'
}
and command ./gradlew wrapper you will get the same error as above.
Solution is to install Gradle 1.10 onto your machine and upgrade your project not using the wrapper
gradle wrapper
You can also get this error if you update your system gradle and forget to update the Android Studio gradle home.
I got this today when running gradle assembleRelease. I had installed the Ubuntu default of gradle-1.4. This didn't work, so I tried the latest gradle-1.12 and got the same issue.
Downloading and using gradle-1.10 (and matching my gradle-wrapper.properties file to that version) resolved the issue.
This is with Android Studio 0.5.8.
Go to dependencies and just change the dependencies classpath to
classpath 'com.android.tools.build:gradle:2.0.0-beta6'
Rest Gradle will take care. Happy coding :)
Ok i guess android studio has answer for this to get this bug out using GUI,
I had this error like this...
after updating the plugins i was facing another issues while building,
so changes the gradle setting to default as shown in the image,
After this build was successful.