Unsupported Gradle DSL method found: 'compile()'!

前端 未结 5 1825
南方客
南方客 2020-12-14 23:29

I\'m going through Google\'s documentation on \"Add Google Play Services to Your Project\" in Android Studio: https://developer.android.com/google/play-services/setup.html

5条回答
  •  情话喂你
    2020-12-15 00:17

    Do not add dependencies in your project by editing its most 'external' build.gradle (YourProject/build.gradle). Edit the one that is under the 'app' module instead (YourProject/app/build.gradle).

    There, by the way, you will find the declaration of one dependency, such as:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    

    This block will be just below android { ... } configuration block. In my case, I am just adding leeloo dependencies, so it became:

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'net.smartam.leeloo:oauth2-client:0.1'
        compile 'net.smartam.leeloo:oauth2-common:0.1'
    }
    

    Then sync your project and dependencies will be downloaded. Hope it helps!

提交回复
热议问题