Gradle build failing after update to Android studio 2.3 Canary 3

早过忘川 提交于 2019-11-30 17:06:09

The solution is to select "Use default gradle wrapper (recommended)" option in the build gradle panel like the image below. Now you can build with gradle 3.2 (in your gradle-wrapper.properties) and android gradle:2.3.0-alpha3 or beta1 as the time of writing

Don't forget to invalidate cache if you have some trouble using File -> Invalidate Cache / Restart

burgyna

I had the same problem, fixed with checking gradle home path. This cannary build is no more working with gradle-2.14.1

The below link shows, point gradle path to gradle 3.2 directory.

The problem is the last version of tools 2.3.0-alpha3. Try to use the 2.3.0-alpha2 in project build.gradle

classpath 'com.android.tools.build:gradle:2.3.0-alpha2'

It's mostly happened when setup new or update version of Android studio. I tried almost all solutions and find some fact that I like to share. It's work for me.

  1. Make sure that updated JDK has set up to your computer and set path location.

Control Panel\System and Security\System-> Advanced system setting -> Advanced -> Enviroment Variables -> edit Path and pest your JDK bin folder location

Ex: C:\Program Files\Java\jdk1.8.0_131\bin

  1. Set Project-level-setting "Use default Gradle wrapper (recommended)" from,

    Android Studio -> File -> Setting -> Build, Exeution, Deployment -> Gradle

  2. Set Android Studio JDK location:

Android Studio -> File -> Project Structure -> SDK Location -> JDK location

  1. If this three thing is done then you need to set Gradle version 3.4.1 or see the latest version from gradle.org/releases.

Android Studio -> File -> Project Structure -> Project -> Gradle Version

  1. After complete setting clean cash Android Studio will recover it own.

Android Studio -> File -> Invalidate caches/ Restart...

If you're using the gradle wrapper, make sure that the distributionUrl in your gradle/wrapper/gradle-wrapper.properties is correct and up to date. As of this writing, I use this:

 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
 distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

try upgrading the Gradle version to 3.2.1

You may face this problem with your previous Project, We will notice that when you create a new application the Gradle build will complete successfully. So just copy paste the grade setting from new project to the previous project.

Steps:

1) Replace Dependencies in build.gradle (project) by this code :

classpath 'com.android.tools.build:gradle:2.3.0'

2) Replace distributionUrl in Gradle-wrapper.properties by this code:

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

3) Don't forget to use Gradle default wrapper in Project level setting.

See this picture for more information

When updating to android studio 2.3, and then load an existing project for older version of android studio, It might take long if not forever on refreshing project. I had the same problem but i fixed it as follows:

  1. first of all go to Gradle Distributions and download any gradle of version greater than 3.2
  2. extract it and save it in a suitable place in your computer.
  3. go to android studio and choose the following path
  4. File->Settings->Build,Execution,Deployment->Gradle
  5. on the right side choose or select Use local gradle distribution
  6. and then browse to where you had saved your downloaded extracted gradle
  7. click apply, then ok.
  8. thats it, your project should now work normally.

change

build:gradle:

from

dependencies { classpath 'com.android.tools.build:gradle +'

to

dependencies { classpath 'com.android.tools.build:gradle:2.2.3'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!