简体   繁体   中英

Jar Lib on Android Project And Android APP

I create a Jar Lib called "errors" in Java. I would like to use it in a module called "AndroidHTTPRequestLibrairy" and in my Android App.

But i have a error :

Program type already present:

In my module (AndroidHTTPRequestLibrairy) build.gradle i have :

implementation files('libs/errors-0.1.3-SNAPSHOT.jar')

And in my app I have :

implementation project(path: ':androidhttprequestlibrairy')

and

implementation files('libs/errors-0.1.3-SNAPSHOT.jar')

I dont understand why.

Can someone help me ?

Sincerely,

This issue appears because of namespace conflict.

You are trying to put one library twice in one project. When the Gradle build your project and at the moment when it tries to put in your app.apk archive the errors-0.1.3-SNAPSHOT.jar library it finds out that there is already the errors-0.1.3-SNAPSHOT.jar library and throws an exception.

So the solutions is to remove the implementation files('libs/errors-0.1.3-SNAPSHOT.jar') dependency form the application build.gradle file, because it allready transited in the implementation project(path: ':androidhttprequestlibrairy') dependency

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM