Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Jetpack compose missing references

I am trying to follow the official google Jetpack compose tutorial on this url but Android studio have an issue resolving the modifier Height()

I am 100% sure that I have imported the correct dependencies as per the tutorial, however, this modifier is no where to be found. It is not deprecated as it is still references in the official docs here

fun NewsStory() {
    val image = +imageResource(R.drawable.header)
        Column(
            modifier = Spacing(16.dp)
            ) {
            Container(modifier = Height(180.dp) wraps Expanded) {
                DrawImage(image)
            }

            HeightSpacer(16.dp)

            Text("A day in Shark Fin Cove")
            Text("Davenport, California")
            Text("December 2018")
        }
}

Am I missing something?

like image 366
AouledIssa Avatar asked Jun 17 '26 01:06

AouledIssa


2 Answers

I assume you are using dev02(because Google's documentation is not updated) dependency for ui-layout dependency, because Height() is added in dev03. Change your ui-layout dependency to dev03:

implementation 'androidx.ui:ui-layout:0.1.0-dev03'

It should work

like image 93
Misha Akopov Avatar answered Jun 18 '26 15:06

Misha Akopov


I needed to add the following to get things running:

//app/build.gradle
...
dependencies {

    ...                                                                   

    //Jetpack Compose
    implementation 'androidx.compose:compose-compiler:0.1.0-dev09'
    implementation 'androidx.compose:compose-runtime:0.1.0-dev09'
    implementation 'androidx.ui:ui-layout:0.1.0-dev09'
    implementation 'androidx.ui:ui-material:0.1.0-dev09'
    implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
    implementation 'androidx.ui:ui-framework:0.1.0-dev09'
}
like image 32
Geoff Langenderfer Avatar answered Jun 18 '26 16:06

Geoff Langenderfer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!