首页 > 解决方案 > 如何在 build.gradle 中找到 implementation() 方法?

问题描述

我想将firebase数据库添加到我的项目中,当android firebase中的firebase构建自动firebase依赖时,最后发生了这个错误:

错误:在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到参数 [com.google.firebase:firebase-database:16.0.1] 的方法 implementation()。构建.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "edmt.dev.androidsimsimi"
    minSdkVersion 23
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
}
    buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
          'proguard-rules.pro'
    }
}
}

dependencies {
implementation 'com.google.firebase:firebase-database:16.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'

//Add Library
implementation 'com.android.support:design:25.1.1'
implementation 'com.github.lguipeng:BubbleView:1.0.1'
implementation 'com.google.code.gson:gson:2.8.0'

implementation 'com.android.volley:volley:1.1.1'

}

标签: androidandroid-gradle-plugin

解决方案


推荐阅读