【问题标题】:Could not find method getCompileConfiguration() for arguments[]找不到参数 [] 的方法 getCompileConfiguration()
【发布时间】:2018-05-02 09:18:39
【问题描述】:

我收到以下错误。

找不到参数 [] 的 getCompileConfiguration() 方法 类型的对象 com.android.build.gradle.internal.api.ApplicationVariantImpl.

【问题讨论】:

  • 显示你的代码。
  • 我是混合(IONIC 1)应用程序开发人员,我安装了 fcm、google 分析和位置插件。我在 build.gradle 中添加了 maven { url "maven.google.com" // Google 的 Maven 存储库 } 插件依赖关系。

标签: android cordova android-studio ionic-framework


【解决方案1】:

我遇到了类似的问题,在互联网上花了一些时间后,我找到了以下解决方案。 如果您在 build.gradle 中使用最新版本的 google-services,则需要进行以下更改:-

1) 在项目级别 build.gradle

        buildscript {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.1.2'
                classpath 'com.google.gms:google-services:3.3.1'
            }
        }

        allprojects {
            repositories {
                jcenter()
                mavenLocal()
                maven {
                    url 'https://maven.google.com/'
                    name 'Google'
                }
            }
        }

2) 在 App 级 build.gradle 中

android{
    //All other
    buildToolsVersion '27.0.3'
    }
        dependencies {
        // All other
            implementation 'com.google.firebase:firebase-database:15.0.1'
        }
        apply plugin: 'com.google.gms.google-services'

3) 在 gradle-wrapper.properties 中

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

【讨论】:

  • 我做了所有更改,但出现错误:- 项目:声明了从配置“debugCompile”到配置“调试”的依赖关系,该依赖关系未在项目描述符中声明:CordovaLib
【解决方案2】:

我们遇到了同样的问题...通过升级 gradle-wrapper.properties 中的 gradle 解决了

distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip

以及 gradle.build 中的 gradle 插件

repositories {
    google()
    ...
}

dependencies {
    ...
    classpath 'com.android.tools.build:gradle:3.1.0'
}

【讨论】:

  • 我做了同样的更改,但它显示以下错误:- 错误:项目:声明了从配置“debugCompile”到配置“调试”的依赖关系,该依赖关系未在项目描述符中声明:CordovaLib。跨度>
猜你喜欢
  • 1970-01-01
  • 2017-01-23
  • 2017-03-22
  • 2018-05-24
  • 2021-11-08
  • 2019-05-18
  • 1970-01-01
  • 2018-05-06
  • 2017-10-18
相关资源
最近更新 更多