Reputation: 1
I have already imported the necessary dependencies for my project to use the flexbox layout. It shows an error that it does not work and cannot find the dependency in my project.
Here i the code I'm trying to work with but it does not recognize the flexboxlayout even though I have the dependencies for it.
<!-- Tags -->
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/post_tags"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:flexDirection="row"
app:flexWrap="wrap"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/post_content"/>
I've already imported the necessary libraries and dependencies.
In my build.gradle [app level]
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)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.firebase.firestore)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
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)
// Add Flexbox dependency
implementation(libs.flexbox)
}
In my libs.version.toml
\[versions\]
agp = "8.4.2"
flexbox = "com.google.android:flexbox:3.0.0"
kotlin = "1.9.0"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
lifecycleRuntimeKtx = "2.8.2"
activityCompose = "1.9.0"
composeBom = "2024.06.00"
constraintlayout = "2.1.4"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.0"
googleGmsGoogleServices = "4.4.2"
firebaseFirestore = "25.0.0"
navigationFragmentKtx = "2.6.0"
navigationUiKtx = "2.6.0"
Upvotes: -1
Views: 156
Reputation: 244
You mentioned dependency in the [versions] section. Please correct.
[versions]
flexbox = "3.0.0"
[libraries]
google-flexbox = { module = "com.google.android:flexbox", version.ref = "flexbox"}
// OR
google-flexbox = { group = "com.google.android", name = "flexbox", version.ref = "flexbox"}
In the gradle file.
implementation(libs.google.flexbox)
Sync the gradle.
Upvotes: 0