Frage

I have a problem using the android support library in my Android Studio project using gradle. If I add the support-library as dependency I will receive and "Error: Gradle: Execution failed for task ':AppName:dexDebug'. I have done a some researches and found the problem using the support-library with other dependencies which are using the support libraries as well (greendao 1.3.0). I would like to use a NavDrawer in my app, so I have to use these support library. If I remove the support library, of course I will receive an inflate error for the "android.support.v4.widget.DrawerLayout".

Does somebody here has an idea?

I used two kind of dependency-imports compile files('libs/android-support-v13.jar') and compile 'com.android.support:support-v4:13.0.0' cause of a found post in a forum. But that doesn't work, too.

Thanks for your support.

Regards, Marine

War es hilfreich?

Lösung 2

I tried it but I receive the dex error as well. Attached you could see my current gradle build-file.

buildscript {
    repositories {
        mavenCentral()
    }
dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
    compile 'com.google.android.gms:play-services:3.1.36'
    compile 'de.greenrobot:greendao:1.3.0'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 18
    }

    sourceSets {
        main {
            java.srcDirs = ['src/main/java', 'src-gen/main/java']
        }
    }
}

The src-gen folder is used for my greendao generated classes. Please let me know if you need some more information.

Edit: I resolved it using the latest greendao version. Added: compile

 de.greenrobot:greendao:1.3.1

instead of compile

 de.greenrobot:greendao:1.3.0

Now it works.

Regards, Marine_of_Hell

Andere Tipps

If your other dependencies also depend on the support lib, you need to make sure they are not using local dependencies (ie embedding the jar file). You should always use only

dependencies {
    compile 'com.android.support:support-v4:x.y.z'
}

and not a local dependencies. Make sure all your dependencies do the same and Gradle will automatically detect that everything depends on the same library and only add it once to dex.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top