简体   繁体   中英

gradle project sync failed android studio

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 (eg 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>

After adding those lines to:

build.gradle (Module: app)

instead of

build.gradle (Project: app)

the error is gone.

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

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'
}

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM