Unable to merge dex after adding dependencies

前端 未结 2 535
故里飘歌
故里飘歌 2021-01-29 00:38

I am getting the error:

Error:Execution failed for task \':app:transformDexArchiveWithExternalLibsDexMergerForPaidFreeDebug\'. java.lang.RuntimeExcepti

2条回答
  •  青春惊慌失措
    2021-01-29 01:21

    Duplicate zip entry [httpcore-4.3.2.jar:org/apache/http/annotation/NotThreadSafe.class]
    

    You are picking up two copies of this Java class, from sources that Gradle is not netting out in its dependency resolution process.

    One possibility is that one of your new dependencies has a transitive dependency on Apache HttpCore, but that libs/droidText.0.2.jar or one of your other dependencies has its own copy of org.apache.http.annotation.NotThreadSafe.

    Android Studio has the "External Libraries" portion of the project tree, if you are in the Project view (rather than the default Android view):

    Android Studio External Libraries tree

    The only way that I know of to track this down is to start sifting through your libraries and try to identify the 2+ that have org.apache.http.annotation.NotThreadSafe. Then, try to figure out how to stop using one of those. The libraries that have this class may be through transitive dependencies, and so you would also need to identify where those transitive dependencies came from. This will be painful, which is why that I am hoping that newer versions of Android Studio will be more helpful here.

提交回复
热议问题