2

I have just started using Android Studio, So forgive me if i am unable to explain the situation properly. But i will try to update details as required.

In my gradle project i use JakeWarton DiskCache with nineoldandroids Both as jar files added to the app/libs folder.

In addition there also a Library project from this location https://android-arsenal.com/details/1/122

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
    compile 'com.github.flavienlaurent:datetimepicker:0f5d399995'
}

I use it by adding the repository and dependency as shown above.

When i try to run this project i get following error

Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException: duplicate entry: com/nineoldandroids/animation/Animator$AnimatorListener.class

I can understand that since my app has a copy of nineoldandroids.jar and the lib-project also needs it at compile time there is some kind of issue.

How can i fix this conflict?

Deepak
  • 1,238
  • 3
  • 22
  • 47
  • 1
    You can remove the nineoldandroids.jar and use compile 'com.nineoldandroids:library:2.4.0' – Gabriele Mariotti Sep 01 '15 at 13:46
  • @Gabriele Mariotti Your solution worked perfectly. Sorry i coud not reply sooner. But i have to ask , what if there are two external libraries using a common dependency jar file packaged as part of their source. – Deepak Sep 02 '15 at 08:11
  • You can use the same jar (same version) in different modules. The problem here is that your library has a maven dependency with nineoldandroids while you have a jar file with the same lib. If it is ok, I will report it as an answer to help other users. – Gabriele Mariotti Sep 02 '15 at 08:30
  • 1
    @Gabriele Mariotti Ok by me, you can report it as an answer. It did solve my issue, thanks again. – Deepak Sep 02 '15 at 08:47

1 Answers1

4

The library com.github.flavienlaurent:datetimepicker:0f5d399995 is using the nineoldandroids library as a maven dependency.

dependencies {
    compile 'com.nineoldandroids:library:2.4.0'
    //...
}

Check the original build.gradle file in github.

To solve your issue you have to:

  • remove the nineoldandroids.jar from your project
  • add the nineoldandroids library as maven dependency in your project

Use:

dependencies{
 //
 compile 'com.nineoldandroids:library:2.4.0'
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841