Friday, April 27, 2018

When Gradle says "program type already present"

Today I helped someone whose Android project was failing to build with a "program type already present" error about the dependencies. I found a Stack Overflow answer that seems to say that the problem is caused by two dependencies needing different versions of the same sub-dependency. To figure out which dependencies are conflicting, you can look at the output of running gradlew app:dependencies (e.g. in the Android Studio terminal). It might be possible to exclude the sub-dependency from the dependency requesting the older version using the Gradle exclude module directive in that SO answer.

2 comments:

  1. What if my computer is giving me this error in a fresh clone and build of master branch, and none of my teammates are getting the error?

    ReplyDelete
  2. While build my android studio project, i found following errors.please help me out.


    Program type already present: org.apache.commons.logging.Log
    Message{kind=ERROR, text=Program type already present: org.apache.commons.logging.Log, sources=[Unknown source file], tool name=Optional.of(D8)}

    ReplyDelete