Could not find method compile() for arguments Gradle

后端 未结 8 911
一整个雨季
一整个雨季 2020-12-02 21:29

Looked around for this solution for much too long now, and I\'m not sure if I missed it or just misstyped something, but my Gradle script will not compile. I am migrating to

相关标签:
8条回答
  • 2020-12-02 22:12

    compile is a configuration that is usually introduced by a plugin (most likely the java plugin) Have a look at the gradle userguide for details about configurations. For now adding the java plugin on top of your build script should do the trick:

    apply plugin:'java'
    
    0 讨论(0)
  • 2020-12-02 22:14

    Hope Below steps will help

    Add the dependency to your project-level build.gradle:

    classpath 'com.google.gms:google-services:3.0.0'
    

    Add the plugin to your app-level build.gradle:

    apply plugin: 'com.google.gms.google-services'
    

    app-level build.gradle:

    dependencies {
            compile 'com.google.android.gms:play-services-auth:9.8.0'
    }
    
    0 讨论(0)
  • 2020-12-02 22:14

    Wrong gradle file. The right one is build.gradle in your 'app' folder.

    0 讨论(0)
  • 2020-12-02 22:16

    Make sure that you are editing the correct build.gradle file. I received this error when editing android/build.gradle rather than android/app/build.gradle.

    0 讨论(0)
  • 2020-12-02 22:18

    In my case I had to remove some files that were created by gradle at some point in my study to make things work. So, cleaning up after messing up and then it ran fine ...

    If you experienced this issue in a git project, do git status and remove the unrevisioned files. (For me elasticsearch had a problem with plugins/analysis-icu).

    Gradle Version : 5.1.1

    0 讨论(0)
  • 2020-12-02 22:18

    Just for the record: I accidentally enabled Offline work under Preferences -> Build,Execution,Deployment -> Gradle -> uncheck Offline Work, but the error message was misleading

    0 讨论(0)
提交回复
热议问题