I am getting the following build error when I try and sync my project:
Error:(9, 0) Gradle DSL method not found: \'compile()\'
Possible causes:The project \
Hi everyone for me it was a "couple days consuming job" to make my app run in Android Studio (I migrated from Eclipse and had this problem too ) . Finally I found that very simple way of it .
That is all Enjoy it.
Declare dependencies in Module's build.gradle file, not in AlexTest's build.gradle file
Just add foolwoing statement in your dependencies
apply plugin: 'jetty'
I have tried applying every single gradle plugin they link me to in that link on the bottom, yet same issue, so I conclude that the first error is the cause.
Correct.
Here is the build.gradle file for AlexTest (the project directory):
You will notice that this file contains a code comment:
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Remove the compile 'com.google.android.gms:play-services:6.1.11'
line from that file. Leave the compile 'com.google.android.gms:play-services:6.1.+'
that you have in the other build.gradle
file.
The dependencies
closure in buildscript
is for Gradle plugins only. The top-level dependencies
closure, found in the module's build.gradle
file, is for application dependencies.
Saw reports that the problem occurred for other reasons, but this solved for me.
If you carry out any changes in the Project Structure (Android Studio) and press OK, Gradle will be synchronized, but this type of synchronization, if the dependency block has something like:
This block will stay this way after synchronization:
One way to solve the problem is to insert a line break to stay as it was before the synchronization or put a semi-colon between the two statements.
I hope it helps.