错误:找不到符号导入android.support.v7.widget.ListViewCompat;

时间:2019-03-01 08:11:44

标签: android build.gradle

将应用迁移到SDK时出现以下错误-28 错误:找不到符号导入android.support.v7.widget.ListViewCompat;

appcompat:27.1.1 目标28 编译28 sdk 28.0.3
这是我的build.gradle文件,我找不到引发错误的问题,找不到符号导入android.support.v7.widget.ListViewCompat;谁能解释为什么要提前抛出感谢信

apply plugin: 'com.android.application'

android {
    signingConfigs {
        config {
            keyAlias '******'
            keyPassword '*********'
            storeFile file('********')
            storePassword '********'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE' // will not include LICENSE file
    }
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    dexOptions {
        //jumboMode true
        javaMaxHeapSize "4g"
    }
    defaultConfig {
        applicationId "com.tekis.health"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 24
        versionName '2018/02'
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
           'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
    productFlavors {
    }
}

dependencies {
    //compile fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    implementation project(':MaterialEditTextlibrary')
    implementation project(':Spinnerlibrary')
    implementation project(':material')
    implementation project(':arcmenulibrary')
    implementation 'com.google.code.gson:gson:+'
    implementation 'com.android.support:cardview-v7:+'
    implementation 'com.android.support:recyclerview-v7:+'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:+'
    implementation  'com.android.support:support-compat:28.0.0'
    implementation 'com.android.support:support-v4:+'
    implementation 'com.google.android.gms:play-services-analytics:16.0.6'
    implementation 'com.wdullaer:materialdatetimepicker:2.3.0'
    implementation 'com.miguelcatalan:materialsearchview:1.4.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
    implementation project(':payUMoneysdk')
    implementation 'com.sun.mail:android-mail:1.5.5'
    implementation 'com.sun.mail:android-activation:1.5.5'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'org.jsoup:jsoup:1.10.2'
    //compile 'org.apache.poi:poi:3.7'
    //compile group: 'org.apache.poi', name: 'poi', version: '3.7'
}
repositories {
    maven { url "https://jitpack.io" }
    google()
}
apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:0)

您正在使用的implementation 'com.android.support:support-compat:28.0.0'具有v4 ListViewCompat,而不是v7可适配类。

使用这个

  

导入android.support.v4.widget.ListViewCompat

评论后

如果您要扩展,则com.android.support:support-compat:28.0.0无法实现,请删除该依赖项。

ListViewCompat作为appcompat-v7:26.1.0中的非最终课程提供

更改

implementation 'com.android.support:appcompat-v7:27.1.1'

implementation "com.android.support:appcompat-v7:26.1.0"

并导入android.support.v7.widget.ListViewCompat

答案 1 :(得分:0)

ListViewCompat已从应用程序兼容库27.x.x或更高版本中删除。

解决方案:您必须改为ListViewRecyclerView