5
1

More than 1 year has passed since last update.

Composeを使っているプロジェクトのbuildSrcにAGPの依存を追加するとビルドがコケる件

Last updated at Posted at 2022-03-01

問題

Composeを使っているプロジェクトで、LibraryExtensionなどを使うためbuildSrc/build.gradle.ktsにAGPの依存を追加すると、

org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering

↑これが出てビルドがコケる。

環境

Kotlin: 1.6.10
AGP: 7.1.2
Jetpack Compose: 1.1.0

解決方法

implementation(kotlin("gradle-plugin:${kotlin_version}"))をdependenciesに追加する。

buildSrc/build.gradle.kts
plugins {
    `kotlin-dsl`
}

repositories {
    mavenCentral()
    google()
}

dependencies {
    implementation("com.android.tools.build:gradle:7.1.2")
    implementation(kotlin("gradle-plugin:1.6.10")) // 追加
}

なぜ直るのかは不明。

参考リンク:https://stackoverflow.com/questions/68759939/couldnt-inline-method-call-remember-into-androidx-compose-runtime-composable

5
1
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
5
1