首页 > 解决方案 > 无法解决:com.android.support:appcompat-v7:jar

问题描述

我是 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 在项目结构对话框中显示受影响的模块:app

标签: javaandroidgradle

解决方案


你应该使用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'

推荐阅读