Forum Discussion
Cannot find import com.microsoft.device.dualscreen.windowstate.WindowState
Hi team,
this might be a noob question but I try to get started using Compose, the Surface SDK and your Dev blog post "https://devblogs.microsoft.com/surface-duo/jetpack-compose-navigation-rail/".
But everything I tried, I cannot import WindowState from com.microsoft.device.dualscreen.windowstate.WindowState.
Thanks for helping me out!
Minor finding:
By the way, If I upgrade the versions number to the newest navigation one, NavigationRail is no longer available. Is this true?
My dependencies (Gradle in *.kts style):
dependencies {
var koin_version = "3.1.5"
var navigation_version = "2.4.0-alpha10"
var compose_version = "1.1.0-alpha06"
// Android
implementation "androidx.compose.material:material:"
implementation "androidx.navigation:navigation-compose:$navigation_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation "androidx.navigation:navigation-compose"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
implementation 'com.google.android.material:material:1.5.0'
// JetBrains
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
// Flow layout
implementation 'com.google.accompanist:accompanist-flowlayout:0.22.0-rc'
// Microsoft
implementation 'com.microsoft.device.dualscreen:twopanelayout:1.0.0-alpha06'
implementation 'com.microsoft.device.dualscreen:windowstate'
// Ktor
implementation("io.ktor:ktor-client-core:1.6.7")
implementation("io.ktor:ktor-client-cio:1.6.7")
implementation("io.ktor:ktor-client-serialization:1.6.7")
// Koin
implementation "io.insert-koin:koin-android:$koin_version"
implementation "io.insert-koin:koin-androidx-compose:$koin_version"
// Map
implementation("com.google.android.libraries.maps:maps:3.1.0-beta")
implementation("com.google.maps.android:maps-v3-ktx:2.2.0")
implementation("androidx.fragment:fragment-ktx:1.4.0")
// Testing
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
tscholze No worries, we welcome all questions 🙂
From the dependencies you included, it looks like you just need to add the version number for the library:
implementation ‘com.microsoft.device.dualscreen:windowstate:1.0.0-alpha1’
And for your NavigationRail question, that component actually comes from the 'androidx.compose.material' library – as long as you have version 1.1.0-alpha01 or later, I believe you should be able to access the component. I tried updating our 'androidx.navigation:navigation-compose’ to version 2.4.0-rc01 and the sample still ran correctly, but let us know if you’re still experiencing issues with using a NavigationRail.
4 Replies
- tscholzeIron ContributorYep, my fold, I did not know that the Window Manager is a dependency in its own 🙂
- khalper
Microsoft
tscholze No worries, we welcome all questions 🙂
From the dependencies you included, it looks like you just need to add the version number for the library:
implementation ‘com.microsoft.device.dualscreen:windowstate:1.0.0-alpha1’
And for your NavigationRail question, that component actually comes from the 'androidx.compose.material' library – as long as you have version 1.1.0-alpha01 or later, I believe you should be able to access the component. I tried updating our 'androidx.navigation:navigation-compose’ to version 2.4.0-rc01 and the sample still ran correctly, but let us know if you’re still experiencing issues with using a NavigationRail.
- tscholzeIron ContributorThanks for your help - the line fixed it!
It was not that easy for me to find a version string that works. I guessed like TwoPane `:1.0.0-alpha01’ but there is no leading 0. xD- khalper
Microsoft
tscholze Awesome, and apologies for the difficulty in finding the correct version string! If that happens again in the future, you can check the "Add to your project" section in the README to see the import string for the latest library version.