https://kotlinlang.org logo
#compose
Title
# compose
t

Travis Griggs

03/05/2023, 12:19 AM
I am digging deeper and deeper into dependency hell I think. Trying to use a newer version of material 3 (whatever would have ModalBottomSheet, 1.0.0 does not). Just when I get a gradle sync to work, I get 1.7 <> 1.8 duplicate class errors. The stackoverflow responses to fix this are all over the map. A while back, using bom had been suggested to me. I have not yet, but if it would get me out of this twisty maze of "WTF is going on here?!?!?" I would welcome it. To wit, does anyone have an example of what my gradle files should look like to go the BOM route, especially if its fit to do M3 Compose? Pretty please?
Here's what I managed to stumble onto eventually: • Get rid of the buildScript stuff that defines global versions in the project build.gradle • Change some versions in the same file:
Copy code
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
}
• Change the compiler version in the module build.gradle:
Copy code
kotlinCompilerExtensionVersion '1.4.3'
• Set the dependencies in same file to:
Copy code
dependencies {
    // <https://developer.android.com/jetpack/compose/setup#kotlin>
    def composeBom = platform('androidx.compose:compose-bom:2023.01.00')
    implementation composeBom
    androidTestImplementation composeBom
    // Material Design 3
    implementation 'androidx.compose.material3:material3'
    // Android Studio Preview support
    implementation 'androidx.compose.ui:ui-tooling-preview'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    // UI Tests
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'
    // Optional - Integration with activities
    implementation 'androidx.activity:activity-compose:1.6.1'
    // Newer version of material
    implementation 'androidx.compose.material3:material3:1.1.0-alpha06'
}
Any attempt to let the IDE change that last one to alpha07 is met with failures en-masse. But this seems decent for now.
d

dorche

03/05/2023, 12:46 PM
t

Travis Griggs

03/06/2023, 5:45 PM
thanks
27 Views