Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle build failing after update to Android studio 2.3 Canary 3

I've recently updated the android studio version of my project from 2.3 Canary 2 to 2.3 Canary 3. Since then the gradle build is failing every time with this error:

Error:Unable to find method 'org.gradle.api.tasks.Sync.getInputs()Lorg/gradle/api/internal/TaskInputsInternal;'. 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 not found solutions like this exactly but those that are similar are not working. Does anyone know how to fix it?

like image 279
BW Müller Avatar asked Dec 13 '16 08:12

BW Müller


People also ask

Why is my Gradle build failing?

If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.

How do I fix build Gradle?

For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.

What is the latest version of Gradle in Android Studio?

7.1.2 (February 2022) Android Gradle Plugin 7.1.


3 Answers

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

enter image description here

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

like image 177
MatPag Avatar answered Oct 13 '22 04:10

MatPag


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.

enter image description here

like image 9
burgyna Avatar answered Oct 13 '22 02:10

burgyna


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'
like image 4
sprik Avatar answered Oct 13 '22 02:10

sprik