Android函数不存在,但在文档中存在



文档中有一个addWeakLoadStateListener()函数,但在我的构建中没有。我有第二页的最新版本。

https://developer.android.com/reference/androidx/paging/PagedList addWeakLoadStateListener (kotlin.Function2)

构建gradle

dependencies {
implementation "androidx.multidex:multidex:2.0.1"
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.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
implementation 'androidx.databinding:databinding-runtime:7.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.dagger:dagger:2.40.5'
annotationProcessor 'com.google.dagger:dagger-compiler:2.40.5'
implementation "com.google.dagger:hilt-android:2.38.1"
annotationProcessor "com.google.dagger:hilt-compiler:2.38.1"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.room:room-runtime:2.4.2'
implementation 'androidx.paging:paging-runtime:2.1.2'
implementation "androidx.activity:activity:1.4.0"
implementation "androidx.fragment:fragment:1.4.1"
implementation 'org.jetbrains:annotations:15.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
annotationProcessor 'androidx.room:room-compiler:2.4.2'
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation "androidx.work:work-runtime:2.7.1"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.retrofit2:converter-simplexml:2.3.0'

}

这似乎是分页3的新功能,因此如果您想使用该功能,则需要升级(例如,implementation "androidx.paging:paging-common:3.1.1")。

最新更新