2017-12-10 20 views
1

私のアプリを実行しようとしましたが、gradleはそれを作成しません。引数のメソッドimplementation()を見つけることができませんでした

私は何をすべきか教えてもらえますか?

Error:(36, 0) Could not find method implementation() for arguments [com.google.firebase:firebase-appindexing:11.6.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

マイアプリのbuild.gradleファイル

minSdkVersion 14 
     targetSdkVersion 22 
     signingConfig signingConfigs.config 
    } 
    buildTypes { 
     release { 
      debuggable false 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
      signingConfig signingConfigs.config 
     } 
    } 
    lintOptions { 
     disable 'MissingTranslation' 
    } 
    productFlavors { 
    } 
} 
dependencies { 
    implementation 'com.google.firebase:firebase-appindexing:11.6.2' 
    compile project(':AndEngine') 
    compile files('libs/gson-2.8.0.jar') 
    compile 'com.android.support:support-v4:22.2.1' 
    compile 'com.google.firebase:firebase-core:10.2.4' 
    compile 'com.google.code.gson:gson:2.8.0' 
    compile 'com.google.android.gms:play-services-ads:10.2.4' 
    compile 'com.google.firebase:firebase-ads:10.2.4' 
    compile 'com.google.firebase:firebase-crash:10.2.4' 

} 
+0

実装を使用するには、プラグイン3.x.xを使用する必要があります。DSL –

+0

@Gabriele Mariottiありがとう、私は慎重ではありません – user7856586

答えて

2

あなたはimplementationを使用するためにあなたのGradleのバージョンを更新する必要が

compile 'com.google.firebase:firebase-appindexing:11.6.2' 

implementation 'com.google.firebase:firebase-appindexing:11.6.2' 

を交換してください。 あなたが廃止されました

buildscript { 

    repositories { 
     google() 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1' 


    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
    } 
} 

compile build.gradleプロジェクトであなたのbuildscriptブロックを更新することを行うことはできません、それはもはや将来のGradleのリリースでサポートされます。

プロジェクトをコンパイルするだけで私が示唆したようにその行を変更できますが、あなたのgradleバージョンを更新し、すべての依存関係にimplementationを使用することを検討してください。

UPDATE

あなたfirebase依存関係のすべてのモジュールで同じバージョンを使用する必要があります。

だから、このよう

dependencies { 
    compile 'com.google.firebase:firebase-appindexing:11.6.2' 
    compile project(':AndEngine') 
    compile files('libs/gson-2.8.0.jar') 
    compile 'com.android.support:support-v4:22.2.1' 
    compile 'com.google.firebase:firebase-core:11.6.2' 
    compile 'com.google.code.gson:gson:2.8.0' 
    compile 'com.google.android.gms:play-services-ads:11.6.2' 
    compile 'com.google.firebase:firebase-ads:11.6.2' 
    compile 'com.google.firebase:firebase-crash:11.6.2' 
} 

それとも、新しいビルドエラーがある可能性がありますあなたのGradleを更新する必要があります可能性があります。

また

compile 'com.android.support:support-v4:22.2.1' 

は最新バージョンではなく、新たな問題をもたらす可能性があります。

しかし、私は一歩一歩を進めることをお勧め:)

UPDATE 2

あなたはこのよう

compile 'com.google.code.gson:gson:2.8.0' 

gsonの依存関係を宣言する場合は、

を必要としません。
compile files('libs/gson-2.8.0.jar') 

これは冗長であり、あなたも可能です。frあなたのlibsフォルダに無用なjarファイル

+0

あなたの答えをありがとう。あなたは部分的に正しいです。セッティングのgradleには時には時間がかかることがあります。 – user7856586

関連する問題