Reputation: 475
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
<ij_msg_gr>Gradle import errors<ij_msg_gr><ij_nav>D:\Important_Docs\Projects\Backup\RLPHYC\android-utils\build.gradle<ij_nav><i><b>project ':android-utils': Unable to build Kotlin project configuration</b><eol>Details: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':android-utils:generateLintModuleInfo'.<eol>Caused by: java.lang.IllegalStateException: Extension not initialized yet, couldn't access compileSdkVersion.</i>
<ij_msg_gr>Gradle import errors<ij_msg_gr><ij_nav>D:\Important_Docs\Projects\Backup\RLPHYC\app\build.gradle<ij_nav><i><b>project ':app': Unable to build Kotlin project configuration</b><eol>Details: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:generateLintModuleInfo'.<eol>Caused by: java.lang.IllegalStateException: Extension not initialized yet, couldn't access compileSdkVersion.</i>
Extension not initialized yet, couldn't access compileSdkVersion.
Tried to invalidate cache restart also used ext in top-level Gradle and also deleted Gradle folder Still error continues
No problem with the Gradle version tried the same with different Gradle versions
Upvotes: 6
Views: 9335
Reputation: 1
could not create task ':app:generateLintModuleInfo'
I had this above problem when i created a new project in android studio. i tried to change gradle version from 4.2.1 to 3.4.3 in project gradle,then it build successfully.like this-
dependencies {
classpath "com.android.tools.build:gradle:3.4.3"}
i think this problem is something wrong appears in gradle version and buildToolsVersion etc,when i creat a new project,it use the leatest android version in default,now is targetSdkVersion 32.
Upvotes: 0
Reputation: 153
could not create task ':app:generateLintModuleInfo'
I had this above problem when i created a new project in android studio. I visited stackoverflow got this question.
then as i didn't got anything i tried to compare build.gradle(:app) files of previously successfully build projects I saw that, their was this extra line
buildToolsVersion "31.0.0"
you will get it bellow compileSdkVersion. just remove above line and sync the gradle file. for me everything worked smoothly later.
Upvotes: 3
Reputation: 1210
like @Vacexe said, this is dexcount plugin's bug.
You can resovle this problem by update dexcount plugin version to 2.0.0:
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:2.0.0'
Upvotes: 10
Reputation: 427
They removed some deprecated methods from the DSL. So not-up-to-date plugins will crash miserably on this update. In fact, issue can come from any gradle plugin that uses deprecated methods from the gradle Android DSL. Just run
$ ./gradlew clean assemble --stacktrace
to understand what plugin calls a deprecated (removed) method, and in general this plugin has a more recent version that no longer uses the deprecated DSL method. In my case, this was junit5, but one has to do the per-case verification.
Upvotes: 1
Reputation: 101
I have the same issue in our project after uplift gradle plugin to 4.1.0 version and it has been solved by removing this plugin
apply plugin: 'com.getkeepsafe.dexcount'
Upvotes: 1
Reputation: 1490
This happened to me when I updated to Android Studio 4.1 and then I changed back to previous settings and everything is working now.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
build.gradle (project)
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
Upvotes: -2