Android Gradle 同步 "Tag Mismatch!"错误

标签 android android-studio gradle compiler-errors build.gradle

过去 3 天以来,我无法解决 Android Gradle Sync“标签不匹配!”的问题错误。我查看并搜索了许多解决方案,但没有一个给出积极的输出。 我还重新安装了 android studio 并重新下载了 SDK,但一切都是顺理成章的。

如果有人知道如何修复此错误,请告诉我

ps,我附上了下图的图片,我使用的是Android Studio 4.1.3版本

Gradle 同步标记不匹配错误

enter image description here

Build.gradle(应用程序)

plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.testsample"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Build.gradle(项目)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

最佳答案

原来是卡巴斯基的安全通道阻止了android studio组件的完整下载。

禁用卡巴斯基,安装 Android Studio 并让您的组件成功下载。

关于Android Gradle 同步 "Tag Mismatch!"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67277353/

相关文章:

gradle - gradle中依赖和依赖之间的区别

java - 初始化错误无法在 Gradle 构建中调用合约测试

java - 在android中使用浮点值设置布局边距

android - 使用 ktor 发送推送通知

android - 数据无法在 Firebase Recycler View 中显示

android - 如何修复此错误 Error Unsupported major.minor version 52.0 in Android studio?

gradle - 如何在Windows的Gradle中指定路径DirectoryDirectory?

java - 在 Webview 中打开本地 Html 文件 - Android

android - Logcat 在 android studio 中是空的,即使它显示在 android 设备监视器中

android - 需要 Gradle 版本 2.2。当前版本是 4.4 错误