Mobile Develop/Android

org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR loweringFile being compiled

nyangzzi 2024. 1. 13. 18:11
반응형

 

android compose로 개발 중에 새 모듈을 추가 했는데 다음과 같은 오류가 발생..

 

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

 

 

막상 해당 프로젝트에는 오류가 될 만한 상황이 보이지 않음

 

오류 전문 보기 v

더보기

org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /Users/nyang/Desktop/responseLayoutGrid/core/src/main/java/com/nyangzzi/response_layout_grid_compose/core/Configuration.kt
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:235)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:68)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:55)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(performByIrFile.kt:41)
at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:43)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.invokeCodegen(JvmIrCodegenFactory.kt:284)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.runCodegen(KotlinToJVMBytecodeCompiler.kt:355)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:136)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:60)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:157)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:94)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:477)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:127)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:366)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:311)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:111)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:165)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:74)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:625)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1739)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN name:rememberGridConfiguration-DRUOcmI visibility:public modality:FINAL <> (layoutWidth:androidx.compose.ui.unit.Dp, horizontalMargin:androidx.compose.ui.unit.Dp, gutterWidth:androidx.compose.ui.unit.Dp, totalColumns:kotlin.Int) returnType:com.nyangzzi.response_layout_grid_compose.core.GridConfiguration
  annotations:
    Composable
  VALUE_PARAMETER name:layoutWidth index:0 type:androidx.compose.ui.unit.Dp
  VALUE_PARAMETER name:horizontalMargin index:1 type:androidx.compose.ui.unit.Dp
  VALUE_PARAMETER name:gutterWidth index:2 type:androidx.compose.ui.unit.Dp
  VALUE_PARAMETER name:totalColumns index:3 type:kotlin.Int
  BLOCK_BODY
    RETURN type=kotlin.Nothing from='public final fun rememberGridConfiguration-DRUOcmI (layoutWidth: androidx.compose.ui.unit.Dp, horizontalMargin: androidx.compose.ui.unit.Dp, gutterWidth: androidx.compose.ui.unit.Dp, totalColumns: kotlin.Int): com.nyangzzi.response_layout_grid_compose.core.GridConfiguration declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt'
      CALL 'public final fun remember <T> (calculation: @[DisallowComposableCalls] kotlin.Function0<T of androidx.compose.runtime.ComposablesKt.remember>): T of androidx.compose.runtime.ComposablesKt.remember [inline] declared in androidx.compose.runtime.ComposablesKt' type=com.nyangzzi.response_layout_grid_compose.core.GridConfiguration origin=null
        <T>: com.nyangzzi.response_layout_grid_compose.core.GridConfiguration
        calculation: BLOCK type=kotlin.Function0<com.nyangzzi.response_layout_grid_compose.core.GridConfiguration> origin=LAMBDA
          COMPOSITE type=kotlin.Unit origin=null
          FUNCTION_REFERENCE 'private final fun rememberGridConfiguration_DRUOcmI$lambda-0 ($layoutWidth: androidx.compose.ui.unit.Dp, $horizontalMargin: androidx.compose.ui.unit.Dp, $gutterWidth: androidx.compose.ui.unit.Dp, $totalColumns: kotlin.Int): com.nyangzzi.response_layout_grid_compose.core.GridConfiguration declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt' type=kotlin.Function0<com.nyangzzi.response_layout_grid_compose.core.GridConfiguration> origin=INLINE_LAMBDA reflectionTarget=null
            $layoutWidth: GET_VAR 'layoutWidth: androidx.compose.ui.unit.Dp declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt.rememberGridConfiguration-DRUOcmI' type=androidx.compose.ui.unit.Dp origin=null
            $horizontalMargin: GET_VAR 'horizontalMargin: androidx.compose.ui.unit.Dp declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt.rememberGridConfiguration-DRUOcmI' type=androidx.compose.ui.unit.Dp origin=null
            $gutterWidth: GET_VAR 'gutterWidth: androidx.compose.ui.unit.Dp declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt.rememberGridConfiguration-DRUOcmI' type=androidx.compose.ui.unit.Dp origin=null
            $totalColumns: GET_VAR 'totalColumns: kotlin.Int declared in com.nyangzzi.response_layout_grid_compose.core.ConfigurationKt.rememberGridConfiguration-DRUOcmI' type=kotlin.Int origin=null

at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate$default(FunctionCodegen.kt:43)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:380)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:397)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:148)
at org.jetbrains.kotlin.backend.jv m.FileCodegen.lower(JvmPhases.kt:44) 
at org.jetbrains.kotlin.backend.common.phaser.FileLoweringPhaseAdapter.invoke(PhaseBuilders.kt:120)
at org.jetbrains.kotlin.backend.common.phaser.FileLoweringPhaseAdapter.invoke(PhaseBuilders.kt:116)
at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invokeSequential(performByIrFile.kt:65)
... 42 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call: CALL 'public final fun remember <T> (calculation: @[DisallowComposableCalls] kotlin.Function0<T of androidx.compose.runtime.ComposablesKt.remember>): T of androidx.compose.runtime.ComposablesKt.remember [inline] declared in androidx.compose.runtime.ComposablesKt' type=com.nyangzzi.response_layout_grid_compose.core.GridConfigurationorigin=null
Method: null
File is unknown
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:63)
at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genInlineCall(IrInlineCodegen.kt:163)
at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCallGenerator$DefaultImpls.genCall(IrInlineCallGenerator.kt:31)
at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genCall(IrInlineCodegen.kt:34)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:522)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:130)
at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:17)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitReturn(ExpressionCodegen.kt:920)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitReturn(ExpressionCodegen.kt:130)
at org.jetbrains.kotlin.ir.expressions.IrReturn.accept(IrReturn.kt:17)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitStatementContainer(ExpressionCodegen.kt:457)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:461)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:130)
at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:17)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.generate(ExpressionCodegen.kt:234)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:122)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:48)
... 51 more
Caused by: java.lang.IllegalStateException: couldn't find inline method Landroidx/compose/runtime/ComposablesKt;.remember(Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.getMethodNode(SourceCompilerForInline.kt:118)
at org.jetbrains.kotlin.codegen.inline.SourceCompilerForInlineKt.loadCompiledInlineFunction(SourceCompilerForInline.kt:96)
at org.jetbrains.kotlin.backend.jvm.codegen.IrSourceCompilerForInline.compileInlineFunction(IrSourceCompilerForInline.kt:93)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:47)
... 67 more


 

새로 추가한 모듈에 compose 라이브러리 의존성을 추가하고 compose함수를 작성했는데,

compose를 활성화하지 않아서 발생한 문제였다.

 

build.gradle.kts (or build.gradle)에 다음 코드를 작성해주면 간단히 해결된다.

 

android {

    //...
    
    buildFeatures {
        compose = true
    }
}

 


 

참고

 

Why am I getting Backend Internal error: "Exception during IR lowering error" when using Jetpack Compose clickable-Modifier?

I am creating a custom Checkbox within a Surface which has a Modifier.clickable: Surface( modifier = Modifier .clickable( enabled = enabled,

stackoverflow.com

 

반응형