Android Studio and Gradle - build fails

Specifying compile files('libs/android-support-v4.jar') means that every library includes support v4. What you want to do is just specify that every library depends on it:

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
}

This will allow gradle to detect all dependencies and include this only once.

Note: You have to first use the SDK Manager and download and install two Maven repositories: "Android Support Repository" and "Google Repository".


I found the problem:

I removed that line from the sample gradle file.

compile files('libs/android-support-v4.jar')

However, I have no idea why this does not work (if I have 2 or 3 external libraries that all depend on the support library, how are we supposed to do, without touching their gradle files?