0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

gradleの評価が循環してしまう問題

Posted at

Androidフォルダ直下のbundle.gradleで以下のエラーが発生した

Cannot run Project.afterEvaluate(Closure) when the project is already evaluated

対象のコード

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(":app")    //ここが原因
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

原因

  1. 各サブプロジェクトが:appの評価を待つ
  2. :app自体もサブプロジェクトの一つ
  3. このため:appが自身の評価を待つという循環状態になる

解決

project.evaluationDependsOn(":app")を削除することで、循環しないようにした

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?