android - 找不到参数 [] 的方法 getCompileConfiguration()

标签 android cordova android-studio ionic-framework

我收到以下错误。

Could not find method getCompileConfiguration() for arguments [] on object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

最佳答案

我遇到了类似的问题,在互联网上花了一些时间后,我找到了以下解决方案。 如果您在 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

关于android - 找不到参数 [] 的方法 getCompileConfiguration(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50131089/

相关文章:

android - 有两个 View 的 ScrollView,第一个 View 填充屏幕

android - 空指针异常按钮setOnClickListener(new OnClickListener()

java - 发生inflate异常 'androidx.appcompat:appcompat:1.1.0'

android - 使用 Gradle 设置 Android 应用版本

jenkins - 让 gradle 执行 JUnit 测试(Android 应用程序,Android Studio)

java - 终止后台线程内长时间运行的任务

android - 如何在 Android 中设置单选按钮

android - 在 jQuery Mobile 中完全下载后如何在 ListView 中显示图像?

android - PhoneGap 应用程序需要互联网连接吗?

ios - 条形码扫描器在 ios 中第一次使用时卡住,而在第二次单击时它工作正常