【问题标题】:could't parse tht android application modules gradles config无法解析 android 应用程序模块的 gradle 配置
【发布时间】:2022-01-04 12:02:02
【问题描述】:

项目模块

而且我真的解决不了。

我见过很多人遇到这个错误,每个人都说删除 jcenter,但在我的情况下,我没有找到 jcenter

已尝试互联网上的所有可用方法,但无法解决此问题 请有人解决这个问题


// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.4"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

**app module**
plugins {
    id 'com.android.application'
}
android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.firstapp"
        minSdk 21
        targetSdk 32
        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
    }
}
dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

【问题讨论】:

    标签: android android-studio gradle android-gradle-plugin connection


    【解决方案1】:

    您的 JUnit 依赖项似乎缺少版本。

    请尝试更换:

    testImplementation 'junit:junit:'
    

    与:

    testImplementation 'junit:junit:4.13.2'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-17
      • 2021-11-01
      • 2017-12-29
      • 2022-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多