I am trying to build an app that uses Media3 by following this: https://developer.android.com/media/media3/exoplayer/hello-world#kts
When I try to add dependencies in my app for its build.gradle.kts Android Studio does not like the syntax given in the above link. Can someone help tell me what I am missing.
P.S. I am doing the kts way not the groovy way as it is the recommended way.
Currently, when I build default empty activity app from Android Studio, my build.gradle.kts looks like:
.....
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
According to android link https://developer.android.com/media/media3/exoplayer/hello-world#kts when I paste:
....
implementation("androidx.media3:media3-exoplayer:1.3.0")
implementation("androidx.media3:media3-exoplayer-dash:1.3.0")
implementation("androidx.media3:media3-ui:1.3.0")
....
It gives me following warning:
Use version catalog instead More... (⌘F1) Inspection info:If your project is using a libs.versions.toml file, you should place all Gradle dependencies in the TOML file. This lint check looks for version declarations outside of the TOML file and suggests moving them (and in the IDE, provides a quickfix to performing the operation automatically)
So:
- What is the correct way to add media3 dependencies for latest Android Studi - Iguana
- Why my default build.gradle.kts for hello world project dependencies format look so different than the one provided in https://developer.android.com/media/media3/exoplayer/hello-world#kts. Default one like something like implementation(libs.androidx.material3), starts with libs. Please help, I am confused.