https://kotlinlang.org logo
#android
Title
# android
s

Shawn Karber_

07/07/2020, 8:49 PM
I am trying to make a kotlin library for android for the first time, and I have what seems like a dumb question: Do i always have to add the dependencies from my library module into the gradle file of the app I'm importing the library into? Example. In my module I am using Ktor to fetch a file. I import the module into an a different android application but the application wont build without also adding Ktor its Gradle file. Is there a way to ensure the these dependencies are automatically included with the module?
👍 1
c

Cheolho Jeon

07/07/2020, 11:40 PM
t

tjohnn

07/08/2020, 7:36 AM
Are you adding ktor to your library dependencies using “compileOnly” by any chance?
j

Javier

07/08/2020, 12:12 PM
Changing
implementation
to
api
in the ktor dependency in your library should fix the problem.
👍 1
s

Shawn Karber_

07/09/2020, 8:04 PM
@tjohnn No i was using implementation @Javier thanks I'll try that
t

TJ Olsen

07/25/2020, 2:20 PM
@Javier I’ve been reading up on this and that is the answer that keeps coming up. So my question on that is why does
implementation
seem to be the standard? Why use
implemention
ever?
Also @Shawn Karber_ , did that work for you?
j

Javier

07/25/2020, 2:46 PM
Because almost all times you don't want to expose other libraries or modules.
👍 1
t

TJ Olsen

07/25/2020, 2:51 PM
Ok. Well this seems like what I should be doing at work. We build a library that we hand off to integrator and partners to build apps for our clients. A part of our integration that I really hate is all the dependencies they have to include just to get our stuff working. Given - a lot of it is Android/material stuff most of them are using anyway. But still.
2 Views