Android referencing third-party packages appears dependent package conflict resolution: Error: Program type already present: org.slf4j.ILoggerFactory

There is a problem. Multiple third-party packages repeatedly rely on the same package:

I have repeated ILoggerFactory in my project as an example:

Error message: Error: Program type already present: org.slf4j.ILoggerFactory

Copy the last class name, double-click shift anywhere in as, and the following appears. Enter the class name such as: "ILoggerFactory"

You can see that in the first and second lines, both jar packages use slf4j-api dependencies. I need to delete one of them

Find related dependencies:

implementation 'com.github.0xZhangKe:WebSocketDemo:3.1'

Use exclude to remove slf4j-api from it. First look at the format of this package  

Corresponding to the wording we removed:

implementation( 'com.github.0xZhangKe:WebSocketDemo:3.1'){
    exclude group: 'org.slf4j',module:"slf4j-api"
}

Pay attention to "()" brackets after implementation.

 

Personal project notes  

 

Guess you like

Origin blog.csdn.net/qq_36355271/article/details/101362874