【问题标题】:I am getting this error A problem occurred evaluating project ':app'. while syncing my project? [closed]我收到此错误评估项目“:app”时出现问题。在同步我的项目时? [关闭]
【发布时间】:2021-05-21 13:49:33
【问题描述】:

我从 github 下载了一个项目。我正在尝试运行它,但它无法运行并给我那个错误。这是我的 gradle.build 文件

apply plugin: 'com.android.application'

repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        applicationId "com.google.firebase.udacity.friendlychat"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    mplementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    // Displaying images
    implementation 'com.github.bumptech.glide:glide:3.6.1'
}

这是我每次运行时收到的错误消息

A problem occurred evaluating project ':app'.
> Could not find method mplementation() for arguments [androidx.appcompat:appcompat:1.2.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

这是我试图在我的 android studio 中运行的项目的链接

https://github.com/udacity/and-nd-firebase

【问题讨论】:

  • 不用担心。我已经弄清楚我犯错的地方了。依赖项中存在拼写错误。表明我已通过在实施(实施)之前添加 i 来纠正它。

标签: android gradle


【解决方案1】:

您的 gradle 文件在依赖项块的第一行中存在拼写错误。

dependencies {
       mplementation 'androidx.appcompat:appcompat:1.2.0'
       ...
}

如果您查看错误提示:找不到方法 mplementation()

请更改mplementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.2.0'

实现拼写错误。
进行上述更改并重新同步您的项目。

【讨论】:

    【解决方案2】:

    答案已经在错误中。第一个实现中缺少一个“i”。

        mplementation 'androidx.appcompat:appcompat:1.2.0'
    

    需要改成

        implementation 'androidx.appcompat:appcompat:1.2.0'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-11
      • 2021-06-26
      • 2020-03-24
      • 1970-01-01
      • 2023-02-13
      • 2021-04-09
      • 1970-01-01
      • 2019-12-05
      相关资源
      最近更新 更多