Did Google update the DrawImage portion of the jetpack compose API?

  • Thread starter greySky
  • Start date
  • #1
4
2

Main Question or Discussion Point

https://developer.android.com/jetpack/compose/tutorial
in the "Add a picture" section

Code:
@Composable
fun NewsStory(){
    val image = +imageResource(R.drawable.header)
    Column (modifier = Spacing(64.dp)){
        Text("A day in shark fin cove")
        Text("davenport")
        Text("december 2018")
        DrawImage(image)
    }
}
Hovering over DrawImage shows: "Unresolved reference: DrawImage", There is no auto import option for this error as there was with "Column" earlier in the tutorial.

I am using Android Studio 4.0 Canary 8
Is my local setup or the linked tutorial out of date? what is the current method to add an image

PS
I actually had two problems, "R.drawable.header" had some error I cannot remember the error text for this error but applying
https://stackoverflow.com/a/49743044
fixed the issue with R.drawable.header", but the DrawImage error persisted.
 

Answers and Replies

  • #2
4
2
found the answer:
build.gradle (:app) [excerpt]:
dependencies {

...
    implementation 'androidx.ui:ui-material:0.1.0-dev03'
    implementation 'androidx.ui:ui-foundation:0.1.0-dev03'
    implementation 'androidx.ui:ui-tooling:0.1.0-dev03'
...

}
Line 5 was missing in the default build.gradle (:app). Adding the line enables the auto-add-import-statement option (under alt-enter like most jetbrains IDEs)

I suppose adding the line for "foundation" (after searching the androidx reference for DrawImage)
https://developer.android.com/reference/kotlin/androidx/ui/foundation/package-summary
would make sense to experienced developers. However following a naive path through the existing tutorial and setup instructions does not make this obvious.
 
  • Like
Likes jim mcnamara

Related Threads on Did Google update the DrawImage portion of the jetpack compose API?

  • Last Post
Replies
1
Views
2K
Replies
3
Views
2K
Replies
4
Views
5K
  • Last Post
Replies
1
Views
930
  • Last Post
Replies
2
Views
14K
Replies
5
Views
2K
Replies
15
Views
3K
Replies
1
Views
511
  • Last Post
Replies
1
Views
2K
Top