2017-10-07 79 views
1

我必須編譯在線購買的項目。在將它導入到Android的studio..it抱怨gradle這個版本,所以我更新了distributionUrl這個distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip無法找到對象上的參數[com.android.support:appcompat-v7:25.4.0]的方法實現()... android

現在當我試圖清理項目和rebuild..it與此錯誤失敗:

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文件:

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:[email protected]') { 
    transitive = true; 
    } 
/* compile('com.digits.sdk.android:digits:2.0[email protected]') { 
    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' 

請問我該如何解決這個問題?

+0

發佈錯誤代碼。 –

回答

4

要使用implementation()你需要使用的gradle V.4gradle這個插件,第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' 
    } 
} 

更多info here.

0

1.打開您的應用程序的build.gradle文件。 2.確保存儲庫部分包含帶「https://maven.google.com」端點的maven部分。例如:

allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 
+0

回購已經在build.gradle文件中......我已經更新了我的問題,並在 – ewom2468

+0

以上的這些詳細信息中放入了整個gradle文件代碼。 –

+0

我已經完成了上述更新 – ewom2468

相關問題