2
votes

i am using a lot of library in my project. And some libraries using same jar file therefore i writed this on build.gradle :

dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.twotoasters.jazzylistview:library:1.2.1'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.orhanobut:dialogplus:1.11@aar'
compile 'com.github.recruit-lifestyle:FloatingView:2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile ('com.specyci:residemenu:1.6+'){
    exclude group: 'com.nineoldandroids', module: 'library'    }
compile files('libs/poppyview.jar'){
    exclude group: 'com.nineoldandroids', module: 'library'    }

}

And i am getting error : Error:(54, 0) Gradle DSL method not found: 'exclude()' Possible causes:

  • The project 'DopingEng' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to version 2.3.1 and sync project
  • The project 'DopingEng' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • Gradle already update , how can i solve this problem ?

    1
    What plugins have you applied? - Abhijit Sarkar
    i do not using plugin. - Tahsin Vural

    1 Answers

    3
    votes

    Here's the problem

    compile files('libs/poppyview.jar'){
       exclude ... 
    } 
    

    A file based dependency does not work in the same way as a dependency coming from a repository. There is no meta data associated with it (eg no dependency information) so there's also nothing to exclude (since there's no transitive dependencies).

    Do you have the pom/ivy meta-data for libs/poppyview.jar? If so then you shouldn't declare it like this (I suggest a local maven repository folder). If you don't then there's nothing to exclude