1
votes

I'm trying to setup nhaarman/ListViewAnimations inside of Android Studio 1.1.0.

From Setup:

Add the following to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
    compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
    compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
}

yet Android Studio says:

Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.

Error:(26, 0) Gradle DSL method not found: 'compile()'
Possible causes:<ul><li>The project 'X' may be using a version of Gradle that does not contain the method.
<a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>
4
I have imported this project a month ago. Did you try clicking on Apply Gradle Plugin? - Atieh
I did and I got list of plugins and Gradle is not in the list. - alexus

4 Answers

1
votes

You are adding these dependencies in the top level build.gradle file.

You have to add these lines in the module build.gradle file.

root
  build.gradle   //top level
  app
     build.gradle   //module level
1
votes

After adding those lines to:

build.gradle (Module: app)

instead of

build.gradle (Project: app)

the error is gone.

0
votes

Try this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
    compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'
}
0
votes

Try removing @arr. worked for me.

//ListView Animations
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0'