Kotlin / Kotlin/kotlin-interactive-shell
Weird issue resolving dep in AS after using KI
- Dominant language
- Java
- Stars
- 612
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
Ok, so I'm this weird issue and not entirely sure what's going on, and hoping here can give me some insights.
I was doing some work in Android Studio, and wanted to test something out related to kotlinx datetime quickly, so I go to the command line and open KI. I try to add the repository, dependsOn, and import classes but couldn't get things to work right. This was the first time I had tried adding a maven repo and trying to access a library with KI. I never got it to work so I went to Intellij and did my test.
I go back to AS and it now can't resolve the kotlinx datetime library anymore (specifically for the version I was trying to use in KI). I cleared my gradle caches, uninstalled KI, reboot my computer but nothing has worked.
I added a `resolutionStrategy` in my build file to force the project to use an earlier version of kotlinx datetime and that gets the project working again, but I can't use the latest version, or at least the version i was using previously. My intellij project seems to be working ok with the latest datetime library.
The error in AS that I get is `Unresolved reference` errors. I'm using AS Flamingo Beta 4 (also have issues with Giraffe). On a mac m1.
example KI input:
```
[0] :repository https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-datetime/0.4.0
[1] :dependsOn org.jetbrains.kotlinx:kotlinx-datetime:0.4.0
WARNING File 'org.jetbrains.kotlinx:kotlinx-datetime:0.4.0' not found (Line_2.kts:1:1)
WARNING org.jetbrains.kotlin.org.eclipse.aether.resolution.DependencyResolutionException: Failed to read artifact descriptor for org.jetbrains.kotlinx:kotlinx-datetime:jar:0.4.0 (Line_2.kts:1:1)
[2] import kotlinx.datetime.Instant
ERROR Unresolved reference: datetime (Line_3.kts:1:16)
[3] :repository https://repo.maven.apache.org/maven2/
[4] :dependsOn org.jetbrains.kotlinx:kotlinx-datetime:0.4.0
[5] import kotlinx.datetime.Instant
ERROR Unresolved reference: Instant (Line_6.kts:1:25)
[6] import kotlinx.datetime.*
[7] :dependsOn org.jetbrains.kotlinx:kotlinx-datetime:0.4.0
[8] import kotlinx.datetime.*
[9] var insta = Instant.now().toString()
ERROR Unresolved reference: Instant (Line_10.kts:1:13)
[10]
```
there were times I would add a repo and the `dependsOn` wouldn't complain, but then KI could only see this package and no classes in the package, `kotlinx.datetime`. I tried add the * to maybe see if that would catch the classes but no luck. I tried a bunch of different repositories but never actually got something to work.
I'm at a loss of what the issue could be or what else I can do. I'm wondering if there's anyway that KI could have affected what I'm seeing with AS, and if anyone has any ideas what could be causing the issue.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Kotlin Interactive Shell transcript using kotlinx-datetime 0.4.0 and the Maven Central repository, then compare it with the Android Studio project behavior described in the issue. Check whether running KI can affect Android Studio dependency resolution; done means identifying a reproducible cause or documenting that no connection exists, with a verified workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100