1

我的项目运行良好,但是当我将 google play services 版本更新为 15.0.0 并将 firebase 添加到项目中时,出现以下错误:

找不到RecyclerView符号android

它说错误:找不到符号导入androidx.appcompat.widget.RecyclerView,我找到了另一个有相同问题的线程,但没有准确说明情况,所以我决定发布一个新问题。

这是我的 Gradle 依赖项:

def acraVersion = '5.1.3'
def gmsVersion = '15.0.0'
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'org.apache.commons:commons-text:1.7'
    implementation 'com.jakewharton:butterknife:10.2.1'
    implementation 'com.daimajia.easing:library:2.1@aar'
    implementation 'com.daimajia.androidanimations:library:2.3@aar'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.github.apl-devs:appintro:v4.2.2'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'co.ronash.android:pushe-base:1.4.0'
    implementation "com.google.android.gms:play-services-gcm:$gmsVersion"
    implementation "com.google.android.gms:play-services-maps:$gmsVersion"
    implementation "com.google.android.gms:play-services-places:$gmsVersion"
    //implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.orhanobut:hawk:2.0.1'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation 'jp.wasabeef:picasso-transformations:2.1.2'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'
    implementation 'com.mikepenz:fastadapter:3.2.4@aar'
    implementation 'com.mikepenz:fastadapter-commons:3.2.4@aar'
    implementation 'com.mikepenz:fastadapter-extensions-expandable:3.2.7@aar'
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    implementation 'com.github.yalantis:ucrop:2.2.1'
    implementation("com.mikepenz:materialdrawer:6.0.6@aar") {
        transitive = true
    }
    implementation 'co.lujun:androidtagview:1.1.4'
    implementation 'com.yarolegovich:discrete-scrollview:1.4.4'
    implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
    implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original@aar'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'android.arch.navigation:navigation-fragment:1.0.0'
    implementation 'android.arch.navigation:navigation-ui:1.0.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
    implementation 'androidx.navigation:navigation-fragment:2.0.0'
    implementation 'androidx.navigation:navigation-ui:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
    implementation project(path: ':toasty')
    implementation project(path: ':rangebar')
    implementation project(path: ':smartlocation')
    implementation files('libs/ImageBase64Encoder.jar')
    implementation "ch.acra:acra-mail:$acraVersion"
    implementation "ch.acra:acra-dialog:$acraVersion"
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.github.jrvansuita:PickImage:2.2.4'
    implementation 'com.github.Cutta:TagView:1.3'
    implementation 'com.github.jakebonk:ChipView:1.0.1'

    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.squareup.retrofit2:converter-scalars:2.8.1'

    // date picker for persian date
    implementation 'com.github.aliab:Persian-Date-Picker-Dialog:1.5.2'

    def paging_version = "2.1.2"

    implementation "androidx.paging:paging-runtime:$paging_version"
    // For Kotlin use paging-runtime-ktx

    // alternatively - without Android dependencies for testing
    testImplementation "androidx.paging:paging-common:$paging_version"
    // For Kotlin use paging-common-ktx

    // optional - RxJava support
    implementation "androidx.paging:paging-rxjava2:$paging_version"
    // For Kotlin use paging-rxjava2-ktx

    //implementation "com.google.firebase:firebase-analytics:$gmsVersion"
}

另一个对我没有帮助的问题和答案相同的线程地址是 StackOverflow 上的类似线程

我一直在尝试的其他一些解决方案:-使缓存无效并重新启动-清理构建

另一个项目依赖项是 smartlocation,它也需要 google play 服务,这里是这个模块依赖项的 gradle 文件:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services-location:15.0.0'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
}
4

1 回答 1

1

我没有看到您在哪里添加了“androidx.recyclerview:recyclerview:1.1.0”的依赖项。请将“implementation 'androidx.recyclerview:recyclerview:1.1.0'”添加到模块级别的 build.gradle 文件中。

于 2020-06-09T06:58:55.387 回答