【问题标题】:Android Gradle Sync "Tag Mismatch!" errorAndroid Gradle Sync“标签不匹配!”错误
【发布时间】:2021-04-27 05:18:16
【问题描述】:

从过去 3 天开始,我无法解决 Android Gradle Sync “标签不匹配!”错误。我查看并搜索了许多解决方案,但没有一个给出积极的输出。 我还重新安装了我的 android studio 并重新下载了 SDK,但一切正常。

如果有人知道如何解决此错误,请告诉我

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

Gradle 同步标签不匹配错误

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
}

【问题讨论】:

  • 发布你的两个 Gradle 文件。
  • @OhhhThatVarun 已添加 gradle 图像。
  • 直接发布您的代码不要添加图片没有人有时间让您额外点击。
  • @OhhhThatVarun 问题已更新。
  • 您的项目中没有任何依赖项?

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


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    可能是因为 Gradle 下载不完整。转到 .gradle 文件夹(对我来说它在用户文件夹中)并删除 /wrapper/dists/ 下的文件。再次尝试下载 gradle。

    【讨论】:

      猜你喜欢
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-21
      • 1970-01-01
      • 2021-07-01
      • 2013-12-16
      相关资源
      最近更新 更多