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

nickk

05/18/2018, 9:37 AM
I replaced
compile
with
implementation
in my Gradle build files and now I am getting this cryptic error: Internal compiler error. See log for more details
Caused by: java.lang.AssertionError: annotation tree hasn't been attributed yet: @kotlin.Metadata(mv = {1, 1, 10}, bv = {1, 0, 2}, k = 1, d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005\u00a2\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016\u00a8\u0006\u0005"}, d2 = {"Lgr/test/fieldobservations/ui/LocationPickerExt;", "Lgr/test/ui/LocationPicker;", "()V", "createAnnotations", "", "app_debug"})
Any idea? (using AS 3.1, Kotlin 1.2.41) This seems to be related to kapt.
l

louiscad

05/18/2018, 9:58 AM
@nickk Did you try with
api
instead of
implementation
?
n

nickk

05/18/2018, 10:11 AM
@louiscad I used
api
instead of
implementation
for
com.android.*
and
com.google.*
dependencies, and my project now compiles. So, external dependencies should be used with
api
? The docs imply the situation is more complicated.
l

louiscad

05/18/2018, 10:13 AM
@nickk Read thoroughly the docs about the difference between the two. Understand that it's important for multi-module projects and build time, (for single module apps, they result in the same behavior)
👍 1
g

gildor

05/18/2018, 1:00 PM
I would say not even for build type (should be the same in case of external dependencies, but can help with your own), but even more important to prevent dependencies and implementation details leaking through transitive dependencies
5 Views