https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
j

jermainedilao

03/05/2018, 12:36 AM
I’m using 3.0.1 in AS 3.0.1
g

gildor

03/05/2018, 2:26 AM
Maybe you could try to reproduce this on sample project. If it’s a bug of Android Plugin would be nice to report an issue and attach this sample project
j

jermainedilao

03/05/2018, 3:08 AM
@gildor got it, already tried on a sample project. it builds successfully if only one local module is added (either java library or android library). App goes into limbo once i add another new local module.
g

gildor

03/05/2018, 3:09 AM
Probably I know what is the reason of this behavior
Probably problem with different class paths
replace
implementation
with
api
in your domain
implementation
dependency hidden from consumer of module with this dependency, it’s special feature of Gradle that allows to use some dependency only internally for some module, without leak abstractions. But if some module expose some type of dependency, you should use api instead.
I’m not 100% sure, but you can try to check this
j

jermainedilao

03/05/2018, 3:15 AM
@gildor you mean, instead of using
implementation project(':domain')
in my data build.gradle i will use this
api project(':domain')
?
g

gildor

03/05/2018, 3:16 AM
yes, in your subprojects. In your
app
module you still use
implementation
j

jermainedilao

03/05/2018, 3:16 AM
I see. let me try
g

gildor

03/05/2018, 3:19 AM
this is simple rule: - if module uses dependency only internally and you don’t expose types of dependency. use
implementation
, it allows you in the future remove or replace this dependency and don’t worry that some consumer used it. - If module uses dependency and expose some types/classes of this dependency to own consumers, use
api
. In this case dependency public API now part of your module public API
j

jermainedilao

03/05/2018, 3:31 AM
Oh my, you’re going to hate me for this. As I was doing what you said above ^. I noticed that in my domain build.gradle.
apply plugin: 'kotlin'
line is missing. Build, and voila. Build succeeded. Thanks so much for the input! I learned something new today.
g

gildor

03/05/2018, 3:33 AM
😱
Ohhh %) Nice. Still not clear for me why you get such error message.
j

jermainedilao

03/05/2018, 3:35 AM
Ikr. Error bit misleading. build failed during
compileDebugKotlin
was my only clue
j

James Coggan

03/06/2018, 1:04 PM
done that in the past, AS doesnt add kotlin to new modules automatically 😕
2 Views