https://kotlinlang.org
Join Slack
Hi everyone, I want to migrate to Kotlin `1.9.0` from `1.8.22` . It all works well on my machine but...
d

dawidhyzy

over 2 years ago
Hi everyone, I want to migrate to Kotlin
1.9.0
from
1.8.22
. It all works well on my machine but fails during a build on CI with:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinStoreYarnLock'.
> yarn.lock was changed. Run the `kotlinUpgradeYarnLock` task to actualize yarn.lock file
I tried running
kotlinUpgradeYarnLock
on my machine but there is no change to yarn lock.
d
h
+3
  • 5
  • 25
  • 1217
Hello, When I try to make a request on a route that does not exist, instead of receiving a 404 I sy...
j

Jamy

almost 3 years ago
Hello, When I try to make a request on a route that does not exist, instead of receiving a 404 I systematically receive a 200 code. Even if I use the StatusPages plugin and I try to modify the behavior of the NotFound status as indicated in the documentation, nothing happens. The 404 code and status are never sent. Do any of you know where this can come from? I confess that I do not see at all where it can come from and I can not isolate the code responsible for this so difficult to send you an example. I specify that the trace marks well that the road is not known:
/, segment:0 -> SUCCESS @ /
    /(method:GET), segment:0 -> FAILURE "Not all segments matched" @ /(method:GET)
    /error, segment:0 -> FAILURE "Selector didn't match" @ /error
Matched routes:
  No results
Route resolve result:
  FAILURE "No matched subtrees found" @ /
j
a
  • 2
  • 15
  • 1209
I'm trying to use kapt in my project and it is working well when I compile manually using maven. How...
d

David Kubecka

almost 3 years ago
I'm trying to use kapt in my project and it is working well when I compile manually using maven. However, the Intellij IDEA integrated builder has trouble when compiling the generated sources. I've filed a bug to IDEA directly as I think the issue might be there (there's a simple reproducer project if anyone would be glad to look at it). To understand the issue more, I would like to know the reasoning behind and perhaps more details of this Maven/Kotlin guide that I followed. I noticed that when I don't "disable" the
maven-compiler-plugin
I get the same error during manual maven compilation ("package does not exist") as I get in IDEA when the pom is set up correctly. Can anyone shed more light into this issue?
d
a
  • 2
  • 17
  • 1209
If I convert a `Color` value to `Int` (using `toArgb()`) so I can save it in Datastore, how would I ...
n

Nat Strangerweather

over 3 years ago
If I convert a
Color
value to
Int
(using
toArgb()
) so I can save it in Datastore, how would I then convert the
Int
back to Jetpack Compose
Color
?
n
s
+2
  • 4
  • 7
  • 1205
I don't really understand how to read / write files in okio 3 multiplatform (specifically on ios). A...
m

Michal Klimczak

about 4 years ago
I don't really understand how to read / write files in okio 3 multiplatform (specifically on ios). All examples show how to do it using
FileSystem.SYSTEM
which is only available on `jvm` . It's like everything is there when you have
FileHandle
or
Sink
, but the first step is vague. Any hints?
m
m
s
  • 3
  • 18
  • 1205
Is there a notion of priority with coroutines? I'd like to do some job in background but I'd like it...
d

dekans

over 7 years ago
Is there a notion of priority with coroutines? I'd like to do some job in background but I'd like it to be executed ASAP, before other queued & less important jobs
d
p
+3
  • 5
  • 31
  • 1205
Hi! I’m having pretty hard time debugging KMM common module on iOS. I can make app compile and run, ...
j

Jan Kuchař

almost 3 years ago
Hi! I’m having pretty hard time debugging KMM common module on iOS. I can make app compile and run, debugger attached, however it: • ignores all line breakpoints • only possible to break on function entry points • when it finaly stops I get into Assembly view • stop on exception in Xcode works (also in assembly view usually) • Kotlin native library APIs usually opens in as Kotlin code when debugging I have debug symbols in kotlin module and in iOS app. Everything looks good, yet it does not work from Android Studio neither. From what I have found out it looks like there is some kind of problem with dSYM debug symbols for llvm generated code from the kotlin library. All .swift files are readable. Most of Kotlin standard library is readable. I have tried to fiddle in Xcode with optimization, linking optimization, debug symbols stripping, etc. Everything is turned off. I have
embedBitcode("marker")
enabled for my binaries. What do I do wrong? This is so frustrating.
gradle:7.4.0, OpenJDK@11, Android Studio 2022.1.1, Xcode 14.2, MacOS 13.1 (ARM)
j
l
+3
  • 5
  • 28
  • 1203
I have some problem with suspend in a Interceptor. I use a interceptor to refresh token: ``` @Single...
a

Android75

over 4 years ago
I have some problem with suspend in a Interceptor. I use a interceptor to refresh token:
@Singleton
class RefreshInterceptor @Inject
constructor(
 private val savePrefSecurity: SavePrefSecurity
) : Interceptor {
   
    override fun intercept(chain: Interceptor.Chain): Response {

       
        var request = chain?.request()
        var response = chain!!.proceed(request)
           if (response.code == 401) {
            var refresh = savePrefSecurity.getSValue(REFRESH_TOKEN)
            if (!refresh.isNullOrBlank()) {
                )
                GlobalScope.launch {
                    var refrehResponse = api.refreshToken(sendRefresh)
                    [....}
                    // other code...
                     return@let intercept(chain)
                }
            }
}
   return response
1. how can i avoid GlobalScope ? because refreshToken is a supend function 2. i think that return@let intercept(chain) is inappropriate blockin
➕ 1
a
l
+2
  • 4
  • 3
  • 1202
what is the most efficient way to round `Double` up to certain decimal points, there is `round()` ...
d

Danish Ansari

about 4 years ago
what is the most efficient way to round
Double
up to certain decimal points, there is
round()
function in Kotlin but it always completely rounds up to 0 decimals? I want something like
round(1.4999,decimalPrecision = 2) // 1.50
d
j
+2
  • 4
  • 29
  • 1201
When kapt complains, that it can't find a `tools.jar` (which is correct, because I'm not using Java ...
h

hho

over 4 years ago
When kapt complains, that it can't find a
tools.jar
(which is correct, because I'm not using Java 8 anymore) – what doesn't work then? Any way to suppress that warning (I'm using Maven)?
h
a
m
  • 3
  • 7
  • 1201
Previous313233Next

kotlinlang

A modern programming language that makes developers happier.

Powered by