Android not building


#1

Hi! I’m trying to build a project but i get the following error any ideas how to fix this?

:transformClassesWithJarMergingForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:transformClassesWithJarMergingForDebug’.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/app/FragmentContainer.class

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 10.158 secs
Error: Error code 1 for command: /development/flot.to.mobile/platforms/android/gradlew with args: cdvBuildDebug,-b,/development/flot.to.mobile/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true


#2

Try adding this to your build.gradle:

// Enabling multidex support.
multiDexEnabled true

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

Example:
.
.
.

defaultConfig
{
minSdkVersion 15
targetSdkVersion 22
versionCode VERSION_MAJOR10000000 + VERSION_MINOR100000 + VERSION_PATCH*1000 + VERSION_BUILD
versionName “${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}”

// Enabling multidex support.
multiDexEnabled true

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

}
.
.
.