Import androidx.compose: Unresolved reference: compose

Hello.

I have such problem. I’m using

Android Studio Hedgehog | 2023.1.1 Patch 2

package com.example.helloworld

import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.Composable
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}

@Composable
fun PrintJson(url: String) {

}

I cannot compile it, cause it says that compose is not found

Unresolved reference: compose
Unresolved reference: Composable

How can I solve this problem? Thanks

image

I dunno anything about Android Studio, but that problem looks like a missing dependency problem. Do you know how Android Studio handles dependency management? Does it have its own system, or use a build tool like Maven or Gradle? Are you able to check your dependencies for your project, and ensure that the Jetpack Compose library is included as a dependency?

You have to make changes to build.gradle file, you have to remove unnecessary implementation from your dependencies, I will we be able to assist you on the changes which are to be made if also specify your build.gradle file code.

1 Like