Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 create plugin of type 'AppPlugin'.
Gradle: : java.lang.NoClassDefFoundError: org/gradle/tooling/provider/model/ToolingModelBuilderRegistry
Gradle: : java.lang.ClassNotFoundException: org.gradle.tooling.provider.model.ToolingModelBuilderRegistry

I don't think it has anything to do with my code, since it all worked in Eclipse. On the other hand, I get other projects created in Android Studio to run. Did I do something wrong when exporting or importing the project?

like image 414
prograde Avatar asked May 20 '13 12:05

prograde


People also ask

How do I resolve errors in build gradle?

Solution: Go in File -> Project Structure -> Project Settings -> Project and set Project SDK to Android API 30 Platform (or the latest). Go in File -> Project Structure -> Project Settings -> Modules and select the Dependencies tab and choose Android API 30 Platform in the Module SDK dropdown.

Why does gradle project Sync Fail?

Sometimes the cache gets corrupted due to which Gradle sync fails.


2 Answers

I was having the same problem. Turned out it was because I had Gradle v1.4 installed. Once I upgraded to v1.6 (download and change path), these problems went away.

like image 92
John C Avatar answered Oct 20 '22 23:10

John C


I met same problem while starting using Android Studio, and tried to compile my app in command-line mode. The solution is simple:

  1. upgrade your Gradle to version 1.6 ( I am not sure if this is required)
  2. set up ANDROID_HOME in your environment. For me it's like this:

    export ANDROID_HOME="/Applications/Android Studio.app/sdk/"
    

and then, it should build your project successfully by using gradle build in your project root folder.

like image 24
Daniel Kao Avatar answered Oct 20 '22 23:10

Daniel Kao