Forum Discussion
App crashes with "Didn't find class "androidx.window.WindowManager""-exception
Hi team,
another newbie question. I try to get the windowManager feature working. After khalper 's awesome tip, I got it building. But now it crashes on runtime. 😕 It must be an simple error but maybe you know it out of the box.
It's also not that easy to transform your sample using the "old" Gradle file to the new Kotlin-based syntax - sorry. Maybe that's the problem and I forget something to include besides the actual dependency.
Links:
- https://gist.github.com/tscholze/cb963ca14ecb6cb3e0a543e5064f59bf
- https://github.com/tscholze/kotlin-surfaceduo-duobahn/blob/t.scholze/9-surface-duo-sdk/app/android/app/build.gradle
tscholze Glad to hear you got your project to build!
Sorry that you're facing issues with transforming our samples, but the good news is that your issue should be solved by updating to the newest version of TwoPaneLayout:
implementation 'com.microsoft.device.dualscreen:twopanelayout:1.0.0-alpha10'
Some of the older versions of TwoPaneLayout depend on older version of the Jetpack Window Manager library, and this can occasionally cause compatibility issues. We try to keep our own SDK dependencies updated in our samples, so you can refer here if you ever have doubts.
Also, I think there are still a few duplicate imports/imports without version numbers in your gradle.kts file - try pasting in the edited version below and let me know if that helps:
dependencies {
var koin_version = "3.1.5"
var navigation_version = "2.4.0-rc01"
var compose_version = "1.1.0-alpha06"
// Android
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:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
// Google
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-alpha10'
implementation 'com.microsoft.device.dualscreen:windowstate:1.0.0-alpha1'
// 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"
}
3 Replies
- khalper
Microsoft
tscholze Glad to hear you got your project to build!
Sorry that you're facing issues with transforming our samples, but the good news is that your issue should be solved by updating to the newest version of TwoPaneLayout:
implementation 'com.microsoft.device.dualscreen:twopanelayout:1.0.0-alpha10'
Some of the older versions of TwoPaneLayout depend on older version of the Jetpack Window Manager library, and this can occasionally cause compatibility issues. We try to keep our own SDK dependencies updated in our samples, so you can refer here if you ever have doubts.
Also, I think there are still a few duplicate imports/imports without version numbers in your gradle.kts file - try pasting in the edited version below and let me know if that helps:
dependencies {
var koin_version = "3.1.5"
var navigation_version = "2.4.0-rc01"
var compose_version = "1.1.0-alpha06"
// Android
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:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
// Google
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-alpha10'
implementation 'com.microsoft.device.dualscreen:windowstate:1.0.0-alpha1'
// 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"
}