在对象... android上找不到参数[com.android.support:appcompat-v7:25.4.0]的方法实现() [英] Could not find method implementation() for arguments [com.android.support:appcompat-v7:25.4.0] on object...android

查看:115
本文介绍了在对象... android上找不到参数[com.android.support:appcompat-v7:25.4.0]的方法实现()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须编译一个在线购买的项目.在将其导入android studio ..时抱怨gradle版本,因此我将distributionUrl更新为此distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

I have to compile a project purchased on line. On importing it into android studio..it complained about the gradle version so i updated the distributionUrl to this distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

当我现在尝试清理项目并重建..失败时出现此错误:

When i now attempted to clean the project and rebuild..it failed with this error :

错误:(45,1)评估项目':app'时发生问题. 在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找不到参数[com.android.support:appcompat-v7:25.4.0]的方法Implementation().

Error:(45, 1) A problem occurred evaluating project ':app'. Could not find method implementation() for arguments [com.android.support:appcompat-v7:25.4.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

下面是整个构建gradle文件:

Below is the whole build gradle file :

 apply plugin: 'com.android.application'

 apply plugin: 'io.fabric'

 android {
   compileSdkVersion 25
   buildToolsVersion '26.0.0'
   defaultConfig {
    applicationId "dumm.value"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 5
    versionName "1.0.4"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 }
 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
 }


  dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 

{

    exclude group: 'com.android.support', module: 'support-annotations'
})
/* Remove This to remove Crashlytics and Fabric */

  compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
    transitive = true;
  }
/*    compile('com.digits.sdk.android:digits:2.0.6@aar') {
    transitive = true;
  }*/
  implementation 'com.android.support:appcompat-v7:25.4.0'
  implementation 'com.android.support:design:25.4.0'
  implementation 'com.android.support:recyclerview-v7:25.4.0'
  implementation 'com.squareup.okhttp3:okhttp:3.8.1'
  implementation 'com.android.support:cardview-v7:25.4.0'
  implementation 'com.github.bumptech.glide:glide:3.8.0'
  implementation 'com.google.android.gms:play-services-maps:11.0.2'
  implementation 'com.google.android.gms:play-services-location:11.0.2'
  implementation 'com.google.android.gms:play-services-places:11.0.2'
  implementation 'com.google.firebase:firebase-auth:11.0.2'
  implementation 'com.google.firebase:firebase-messaging:11.0.2'
  implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
  implementation 'com.google.code.gson:gson:2.8.0'
  testCompile 'junit:junit:4.12'


 }

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

请问我该如何解决?

推荐答案

要使用implementation(),您需要使用 gradle v.4 gradle插件v.3

To use implementation() you need to use gradle v.4 and the gradle plugin v.3

使用:

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

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        maven {
            url "https://maven.google.com"
        }            
        //google()  //only if you use Android Studio 3.x
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta7'
    }
}

更多此处的信息.

这篇关于在对象... android上找不到参数[com.android.support:appcompat-v7:25.4.0]的方法实现()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆