2017-04-09 8 views
-1

以下のgradleのエラーのためアンドロイドアプリケーションを実行できません。Android Gradleメソッドが見つかりません: 'compile()'

Gradle DSL method not found : 'compile()' 
Possible Causes : 
       The project XXXX may be using a version of Gradle that does not contain the method . 

The build file may be missing a Gradle Plugin . 

解決方法を教えてください。

EDIT:

ファイルbuild.gradle

PFBプロジェクトから私のbuild.gradleファイル、ほとんどのファイルは依存関係に追加されるようだが、問題は同じに対処できない理由。

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
} 


android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "xxxxxxxx" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 2 
     versionName "1.2" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

android { 
    useLibrary 'org.apache.http.legacy' 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'me.zhanghai.android.materialprogressbar:library:1.1.6' 
    compile 'com.android.support:support-v4:23.4.0' 
    compile 'com.sa90.materialarcmenu:library:1.4.1' 
    compile files('libs/jxl.jar') 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'com.github.clans:fab:1.6.4' 
    compile 'com.android.support:cardview-v7:23.4.0' 
    compile files('libs/acra-4.6.1.jar') 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'commons-codec:commons-codec:1.10' 
    compile "com.android.support:support-v4:+" 
    compile 'com.squareup.picasso:picasso:2.3.2' 
    compile 'com.nineoldandroids:library:2.4.0' 
    compile 'com.daimajia.slider:library:[email protected]' 
} 
+1

は、あなたの質問を編集してくださいし、[MCVE]提供します。これには、このエラーメッセージを引き起こす 'build.gradle'ファイルが含まれます。 – CommonsWare

+0

トップレベルのbuild.gradkには、特にあなたのアプリの依存関係を置くためにNOTと書かれています –

答えて

0

あなたはプロジェクトbuild.gradleに依存していますが、app/build.gradleに配置してください。

アプリ/ build.gradleの例では

dependencies { 
    compile 'com.android.support:appcompat-v7:25.2.0' 
} 
関連する問題