Search code examples
javaandroidfoldable-devices

ActivitySplitLayoutBinding is unresolved; what is the required library?


I try to implement the code described in the "java with callbacks" section of the document in https://developer.android.com/guide/topics/large-screens/make-apps-fold-aware. But ActivitySplitLayoutBinding is unresolved.

Here is an extract of my build.gradle file:

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.core:core:1.7.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "androidx.window:window:1.0.0"
implementation "androidx.window:window-java:1.0.0"
implementation "androidx.window:window-rxjava2:1.0.0"
implementation 'androidx.startup:startup-runtime:1.1.1'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation 'com.opencsv:opencsv:5.0'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

What am I missing?


Solution

  • ActivitySplitLayoutBinding is not coming from any library but is just a view bindings definition linked to a xml layout.

    E.g. in this sample, there will be a .xml named activity_split_layout.xml when you use ViewBindings, then you will have a definition named ActivitySplitLayoutBinding in your Activity class, so you can access to all its views from the layout.

    You can learn more about ViewBindings here: https://developer.android.com/topic/libraries/view-binding

    Hope that this helps.

    -Cesar