https://kotlinlang.org
Join Slack
EDIT: I solved this I’m writing a test for a class handling a 3rd party analytics library. The class...
p

Peter Farlow

over 3 years ago
EDIT: I solved this I’m writing a test for a class handling a 3rd party analytics library. The class under test needs to handler an
Analytics
object, but unfortunately
mockk<Analytics>()
cannot create a mock because of a static android Handler in that class:
public class Analytics { // this is 3rd party code I can't change

  static final Handler HANDLER =
      new Handler(Looper.getMainLooper()) {
        @Override
        public void handleMessage(Message msg) {
          throw new AssertionError("Unknown handler message received: " + msg.what);
        }
      };
// rest of class here
}
I tried using both
mockk<Analytics>()
and adding
mockkConstructor(Handler::class)
but that didn’t work. Any suggestions?
p
m
  • 2
  • 8
  • 1227
What is the best way to add a scroll bar to a LazyColumn in Jetpack Compose?
s

spierce7

about 2 years ago
What is the best way to add a scroll bar to a LazyColumn in Jetpack Compose?
s
a
+2
  • 4
  • 5
  • 1227
Does anyone know if there’s a way to disable the swipe away gesture on a ModalBottomSheetLayout? I ...
m

mattinger

over 3 years ago
Does anyone know if there’s a way to disable the swipe away gesture on a ModalBottomSheetLayout? I can veto the change so that the sheet stays up, but id rather the user not be able to drag the content away in that case. why let them drag to dismiss if we’re just going to veto it anyway? A related question is that if i decide to allow a click outside or for them to swipe it away, is there a way to react that that?
m
c
j
  • 3
  • 10
  • 1223
<< UPDATE: THIS HAS BEEN RESOLVED >> << FIX: I just had to use a unit with the `kotlin.daemon.jvmarg...
s

Shubham Singh

11 months ago
<< UPDATE: THIS HAS BEEN RESOLVED >> << FIX: I just had to use a unit with the
kotlin.daemon.jvmargs
property inside my
gradle.properties
file (e.g. replace
-Xmx2048
with
-Xmx2048m
) >> I'm not sure why, but I've started seeing these errors whenever I run my Kobweb app (using
kobweb run
), make changes to any file, and save (using
Cmd + S
). Has anyone else observed these?
(Errors inside the thread) Because of these, the re-build time (on each save) has also gotten slower.
s
d
  • 2
  • 26
  • 1221
how are you using Detekt on multiplatform projects these days? I was hoping to find a <single task> ...
f

fred

almost 3 years ago
how are you using Detekt on multiplatform projects these days? I was hoping to find a single task that would sweep my entire project but from what I see this doesn’t exist and is being tracked here, so the options I see are: • create this task myself (any directions on how I could do that?) • do something like this, it seems to work great (basically setting the module root to be the source so all source sets are considered) • run multiple tasks: ◦
detektMain
to sweep non-multiplatform stuff with type resolution ◦
detektMetadataMain
to sweep
commonMain
on all modules (found this one here) ◦
detektAndroidDebug
and
detektAndroidRelease
to sweep Android code in multiplatform modules ◦ …and how do I sweep iOS code in multiplatform modules? I’ve tried
detektMetadataIosMain
,
detektIosX64Main
,
detektIosArm64Main
and
detektIosSimulatorArm64Main
but they all seem to fail to find issues on code inside
iosMain
— should I file an issue or am I missing something? I have a minimum reproducible example here: https://github.com/tfcporciuncula/detekt-kmm-issue (this commit summarizes everything) • any other option?
👀 2
f
m
+2
  • 4
  • 6
  • 1218
how can I use kotlin-reflect to get all subclasses of an abstract base class? the base class is NOT ...
p

Peter Ertl

almost 5 years ago
how can I use kotlin-reflect to get all subclasses of an abstract base class? the base class is NOT sealed
p
m
t
  • 3
  • 34
  • 1217
What's the best way to generate an .aar file from a multiplatform build.gradle file? My iOS targets ...
s

Sylvain Patenaude

over 5 years ago
What's the best way to generate an .aar file from a multiplatform build.gradle file? My iOS targets generate .framework outputs, but I would now like to wrap my android target jar file in an .aar file. Thanks in advance.
s
k
  • 2
  • 33
  • 1206
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
  • 1203
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
  • 1200
Can we use lottie animations in compose KMM.
f

Farhazul Mullick

almost 2 years ago
Can we use lottie animations in compose KMM.
f
h
a
  • 3
  • 4
  • 1199
Previous303132Next

kotlinlang

A modern programming language that makes developers happier.

Powered by