Daniel
Daniel

Reputation: 37061

access jar in project from imported library - gradle / android studio

I have an android project (call it myProj) and android library (call it myLib) Now inside the myLib I have a bunch of jar files that it rely on, and one of those jar that is inside myLib (libs folder) is needed for my android project myProj

How can I load / introduce that jar file to myProj??? no matter what I've done it can't see that jar - By that I mean that I can't add imports that are present inside that jar (and if I add it to myProj libs folder I get Error: Program type already present: (obviously)

I already tried creating third project with configurations.create("default") artifacts.add("default", file('somelib.jar'))https://stackoverflow.com/a/22415260/617373 but id didn't work at all...

and the following does not help either File ->Project Structure ->App-> dependencies -> + ->add library by adding a library you don't add its jars :(

Any Ideas are welcomed

Upvotes: 1

Views: 383

Answers (1)

luckyging3r
luckyging3r

Reputation: 3165

If this doesn't work:

File ->Project Structure -> App-> dependencies -> + ->add library

In your myProj build.gradle file add:

dependencies {
    implementation files('../myLib/libs/somelib.jar')
}

sync project with gradle files and then make project

Upvotes: 2

Related Questions