I have a strange issue with `shareIn`. in an Andro...
# flow
m
I have a strange issue with
shareIn
. in an Android Studio project. The editor code-completes it, I can jump to the source of it, but when I compile I get a
Unresolved reference: shareIn
it sounds like the compiler and the editor isn’t in sync, but I don’t know how to solve it.
e
You might have conflicting dependencies in your project. Please check
gradlew dependencies
and see if you have
kotlinx-coroutines-xxx
artifacts with different versions or something like that.
m
All of them points to
1.4.1
, i’m also using
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10
if that helps?
e
Really strange, then. Seems something specific to your project setups. Do you get the same problem if you just create an new project and add coroutines dependency to it?
Also, please try "Invalidate caches / Restart..." action (Cmd+A on Mac, Ctrl+A on Win)
m
new project, added dependency after dependency until it failed. it seems to happen when I add
com.android.billingclient:billing-ktx:3.0.1
according to
dependencies
output, it should use the correct coroutine version, but something must fail.
Copy code
\--- com.android.billingclient:billing-ktx:3.0.1
     +--- com.android.billingclient:billing:3.0.1
     +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50 -> 1.4.10 (*)
     \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0 -> 1.4.1 (*)
removing billing solves the
shareIn
problem, but it creates a few others 😉
e
Can you, please, share the failing project setup to https://kotl.in/issue
m
Ill do that during the day.. no problem.
ill create a ticket as well
if anyone else has the problem and need a quickfix, exclude the Kotlin dependencies from the billing lib.
Copy code
implementation('com.android.billingclient:billing-ktx:3.0.1') {
        exclude group: 'org.jetbrains.kotlinx'
        exclude group: 'org.jetbrains.kotlin'
    }