为什么在尝试实现这些库时出现错误?

时间:2019-07-01 18:29:20

标签: java android build.gradle implementation

我在以下两个实现中遇到此错误:

implementation 'com.android.support:recyclerview-v7:28.0.0'

implementation 'com.android.support:cardview-v7:28.0.0'

我试图删除sdk android 9并安装任何其他版本,但没有成功

implementation 'com.android.support:recyclerview-v7:28.0.0'

implementation 'com.android.support:cardview-v7:28.0.0'

那我得到的

ERROR: startup failed:
build file 'D:\Android\fb\app\build.gradle': 34: unexpected token: 
com.android.support:gridlayout-v7:28.0.0 @ line 34, column 20.
Implementation 'com.android.support:gridlayout-v7:28.0.0'

我尝试同步文件,并成功同步,但在代码下仍显示红线,应用程序运行正常

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.example.picupload"
        minSdkVersion 14
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-storage:16.0.4'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'


}

最后3行是我添加的

1 个答案:

答案 0 :(得分:-1)

在gradle中的依赖项中添加它-

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

然后转到 Android Studio > 构建(在顶部)> 清理项目> 重建项目