Android studio Gradle Could not find method compile()
android, android-studio
Solution
The answer to this question might help you to import your gson library correctly and avoid any compile/link issues: Android Studio - Importing external Library/Jar. Another related link: Android Studio: Add jar as library? with accepted answer. Both answers say the same thing. `gradlew clean` after you add/import the jar file and edit the build.gradle file.
HTH.
Edit: There are two build.gradle files. You should be editing the build.gradle that's under your project folder and not the one under your project-root folder.
Problem
The past two days i have tried to find a solution to this problem but with no luck. I am trying to include `GSON` lib. Into my android project. Here is a picture of my folder structure: Now in my build.gradle i have the following: ``` // Top-level build file where you can add configuration options common to all sub-projects/modules. dependencies { compile files('libs/gson-2.2.4.jar') } ``` i have also right clicked gson-2.2.4.jar and added it as a lib. When i compile i get the following error: ``` Gradle: A problem occurred evaluating root project 'notebox-android'. > Could not find method compile() for arguments [directory 'libs'] on root project 'notebox-android'. ``` Can anyone help me with this? please tell me if you need more information!