Gradle DSL method not found: 'compile()' when excluding support-v4 and/or commons-io
Asked Answered
T

0

0

I am having trouble with my project. I was getting this error and after applying the sugested solution I am getting this error, however the solution does not apply to me. Here is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    packagingOptions {
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    defaultConfig {
        applicationId "codechallenge.com.redditer"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

//configurations{
//    all*.exclude group: 'com.android.support', module: 'support-v4'
//}

repositories {
    maven {
        url "http://repo.mycompany.com/maven2"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13'
    compile 'org.codehaus.jackson:jackson-xc:1.9.13'
    compile 'com.fasterxml.jackson.core:jackson-core:2.6.0'
//    compile 'com.octo.android.robospice:robospice-cache:1.4.14'
//    compile 'com.octo.android.robospice:robospice:1.4.14'
//    compile 'com.octo.android.robospice:robospice-spring-android:1.4.14'


    compile ('com.octo.android.robospice:robospice-cache:1.4.14'){
        exclude module: 'support-v4'
        exclude group: 'org.apache.commons', module 'commons-io'
    }
    compile ('com.octo.android.robospice:robospice:1.4.14'){
        exclude module: 'support-v4'
        exclude group: 'org.apache.commons', module 'commons-io'
    }
    compile ('com.octo.android.robospice:robospice-spring-android:1.4.14'){
        exclude module: 'support-v4'
        exclude group: 'org.apache.commons', module 'commons-io'
    }
    compile 'commons-io:commons-ic:1.3.2'
}

Also tried

compile ('com.octo.android.robospice:robospice-cache:1.4.14'){
    exclude module: 'support-v4'
    exclude group: 'org.apache.commons', module 'commons-io'
}
compile ('com.octo.android.robospice:robospice:1.4.14'){
    exclude module: 'support-v4'
    exclude group: 'org.apache.commons', module 'commons-io'
}
compile ('com.octo.android.robospice:robospice-spring-android:1.4.14'){
    exclude module: 'support-v4'
    exclude group: 'org.apache.commons', module 'commons-io'
}
complie 'commons-io:commons-ic:1.3.2'

Any help will be greatly appreciated

My root build.gradle is:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
Thoria answered 6/8, 2015 at 13:8 Comment(7)
complie 'commons-io:commons-ic:1.3.2' -> compile 'commons-io:commons-ic:1.3.2'Carpet
I updated the code but am still getting the same error I believe it has something to do with the exclude compile blocksThoria
Could you also specify the contents of your root build.gradle?Carpet
@Carpet I´ve updated the question, thanks!Thoria
I can also see a problem with the artifact coordinates: compile 'commons-io:commons-ic:1.3.2' -> compile 'commons-io:commons-io:1.3.2'. Could you also merge the two android closures into a single one?Carpet
@Carpet Done and updated :)Thoria
Let us continue this discussion in chat.Thoria

© 2022 - 2024 — McMap. All rights reserved.