2016-10-21 15 views
1

私は今、長い間、このエラーが直面しています。..AndroidのビルドのGradle与えるcomplie()エラー

Error:(24, 0) Could not find method compile() for arguments 
    [com.google.code.gson:gson:2.3] on object of type 
    org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 

マイルートbuild.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.1' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
    } 
} 
task clean(type: Delete) { 
    delete rootProject.buildDir 
} 



//apply plugin: 'com.android.application' 
// 
//android { 
// compileSdkVersion 23 
// buildToolsVersion '23.0.0' 
//} 

ですそして、私のmodule/build.gradle

apply plugin: 'com.android.application' 
android { 

    compileSdkVersion 23 
    buildToolsVersion "23.0.0" 

    defaultConfig { 
     applicationId "com.example.zumoappname" 
     minSdkVersion 7 
     targetSdkVersion 17 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    repositories { 
     flatDir { 
      dirs 'aars' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.google.code.gson:gson:2.3' 
    compile 'com.google.guava:guava:18.0' 
    compile 'com.squareup.okhttp:okhttp:2.5.0' 
    compile 'com.microsoft.azure:azure-mobile-android:3.1.0' 
    compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar') 
} 
です

誰かが正しい方向に私を案内してくれますか。

そしてこの前、私は「アンドロイド方法」について、同様のエラーを受け取った。..

は、私は多くのことをグーグルではなく、多くの使用でした。 ありがとうございます。

+0

GSONライブラリを最新のバージョンに更新しようとしましたか? 'compile 'com.google.code.gson:gson:2.7''? –

+0

さよなら..うまくいきませんでした。 – Kshitij

答えて

0

ファイルに問題があるようです。

構造でなければならない:

apply plugin: 'com.android.application' 
android { 

    compileSdkVersion 23 
    buildToolsVersion "23.0.0" 

    defaultConfig { ... } 
    buildTypes { 
     release {...} 
    } 
} 

repositories { .. } 

dependencies { 
    //.. 
} 
androidブロックの外側 repositoriesブロックを移動

+0

さて、私はこれをやりました。 – Kshitij

関連する問題