无法解决:com.android.support:appcompat-v7:jar

时间:2019-09-23 12:37:42

标签: java android gradle

我是Android Studio平台的新手。我收到此错误 “无法解决:com.android.support:appcompat-v7:jar”

当前,我的Android Studio版本是3.5.0。 我在build.gradle存储库中添加了google()

这是我的build.gradle(项目)


buildscript {
    repositories {

        jcenter()
    google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:3.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    google()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这是我的build.gradle(模块应用)

apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.kartik.barcode"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:appcompat-v7:jar:28.0.0-alpha1'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    //implementation 'com.android.support:design:jar:28.0.0-alpha1'
    implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    implementation 'com.google.zxing:core:3.2.0'
   // implementation 'com.android.support:design:jar:28.0.0-alpha1'//for The edittext animation
    implementation 'com.google.firebase:firebase-database:9.0.0'//for firebase
    implementation 'com.google.firebase:firebase-auth:9.0.0'
    implementation 'com.google.firebase:firebase-storage:9.0.0'
    implementation 'com.google.android.gms:play-services-auth:9.0.0'
    implementation 'com.google.firebase:firebase-appindexing:19.0.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
}

我仍然收到此错误: 错误:无法解决:com.android.support:appcompat-v7:jar 在项目结构对话框中显示 受影响的模块:应用

1 个答案:

答案 0 :(得分:2)

您应该使用 PROPER 版本。在此依赖项中没有 jar

使用稳定

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

仅供参考

  

请通过更新以下版本来解决版本冲突:   google-services插件或更新其版本   com.google.android.gms到11.4.2

您应该升级到以下版本

implementation 'com.google.android.gms:play-services-auth:17.0.0'

如果使用升级的类路径,这将是一个很好的方法

classpath 'com.google.gms:google-services:4.2.0'