2017-11-20 10 views
2

このエラーが発生します。私はsdkマネージャーのすべてをチェックしているので、私はかなり混乱しています。エラー:(30、0)引数のメソッドコンパイル()が見つかりません

Error:(30, 0) Could not find method compile() for arguments [com.android.support:appcompat-v7:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Please install the Android Support Repository from the Android SDK Manager. Open Android SDK Manager

build.grandleで自分のコードに何か問題があります:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 

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


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

allprojects { 
    repositories { 
     google() 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

dependencies { 
    compile 'com.android.support:appcompat-v7:+' 
} 

または不足しているものですが...?

+0

どのバージョンを使用しているのですか? 3.0.0がこのように続く場合https://stackoverflow.com/questions/46267621/unable-to-merge-dex/47304057#47304057 –

+1

これをもう一度読んでみたいかもしれません... '注記:ここにアプリケーションの依存関係を置かないでください; '... @KingofMassesそのエラーは非常に異なります –

答えて

1

Gradleビルドツール3.0.0を使用する場合は、「コンパイル」を使用しないでください。

"compile"が "implementation"に置き換えられました。

プロジェクトbuild.gradleファイルに依存関係を追加することはできません。
モジュールbuild.gradleファイルに依存関係を追加する必要があります。もしそうならば、単に元のブロックにコンテンツを追加し

dependencies { 
    implementation 'com.android.support:appcompat-v7:+' 
} 

「依存関係」ブロックがすでにあるかもしれません、:「アプリ」ディレクトリ内build.gradleファイルでそう

、これらの行を追加します。 。

3

あなたトップレベルのファイルcompile() DSLを使用することはできません。

は、このブロックの削除:

dependencies { 
    compile 'com.android.support:appcompat-v7:+' 
} 

をしてapp/build.gradleファイル内dependenciesブロック内の依存関係を追加します。

関連する問題