Task 'prepareKotlinBuildScriptModel' not found in project ':app'

Viewed 28466

I am getting this error while gradle sync. This is react native project. enter image description here

5 Answers

I was able to work around this issue by adding this line to my build.gradle file:

task prepareKotlinBuildScriptModel {

}

I had to disable Kotlin in the intellij

Open Preferences>Plugin>Disable Kotlin

enter image description here

just add

tasks.register("prepareKotlinBuildScriptModel"){} 

to build.gradle(Module.app) file.

For anyone who is working with Ionic Framework (V5), I got this simply because I had opened the /app folder in Android Studio by mistake, instead of opening the root platforms/Android/ project.

Opening the correct root folder then showed the project explorer tree in Android studio as:

  • Android
    • app
    • CordovaLib
    • Gradle Scripts

I was then able to generate a signed apk as usual.

Disabling Kotlin Plugin , will Crash Your Android Studio so dont Disable it. if you did , delete the disableplugins.txt from c:/users/yourusername/appdata/roaming/google/androidversion


This will work and safe to use.

tasks.register("prepareKotlinBuildScriptModel"){}

Related