https://kotlinlang.org
Join Slack
How to serialize a reasonably complex type that is not in my control? I am interested in storing a <...
r

Ryan Rolnicki

about 4 years ago
How to serialize a reasonably complex type that is not in my control? I am interested in storing a Google Places API response, but there are a plethora of types that of course aren't marked as `@Serializable`; to avoid adding custom logic for each, is there an easy way to create the serializers as if I the classes had the annotation? Or is the best options to use a reflection based serialzer like gson?
r
b
+2
  • 4
  • 33
  • 600
Hello guys! I have an `.aar` library, which is located on the project level: `libs/lib.aar`. I decl...
u

ubu

over 4 years ago
Hello guys! I have an
.aar
library, which is located on the project level:
libs/lib.aar
. I declare it in an Android Library module in the following manner:
implementation files('libs/lib.aar')
After updating to the latest Android Gradle Plugin:
-classpath 'com.android.tools.build:gradle:3.5.3'
 +classpath 'com.android.tools.build:gradle:7.0.0-beta02'
I got this error message:
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error)
The only thing I could find on Stackoverflow was the following: https://stackoverflow.com/questions/60878599/error-building-android-library-direct-local-aar-file-dependencies-are-not-supp But these solutions seem outdated. Following official documentation here didn’t help either. Did someone encounter this issue? Need help! 🆘
u
p
+2
  • 4
  • 24
  • 600
Hi, I get this error when i run gradlew (gradle version 6.6.1) using io.kotest:kotest-runner-junit5-...
t

thol01

about 5 years ago
Hi, I get this error when i run gradlew (gradle version 6.6.1) using io.kotestkotest runner junit5 jvm4.2.3. But it does work with kotest 4.2.0.RC2.
t
l
s
  • 3
  • 145
  • 600
Hello guys, I need your help I'm building kmm application and part of the api call is md5 hash key, ...
m

Mod

almost 3 years ago
Hello guys, I need your help I'm building kmm application and part of the api call is md5 hash key, I made the implementation for android part but for iOS I couldn't use CryptoKit because it's pure swift and using the CoreCrypto I faced a lot of trouble converting the swift code to kotlin this is the contract:
expect object EncryptionHelper {
    fun md5(input: String): String
}
this is the Android part:
import java.math.BigInteger
import java.security.MessageDigest

actual object EncryptionHelper {
    actual fun md5(input: String): String {
        val md = MessageDigest.getInstance("MD5")
        return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0')
    }
}
m
e
j
  • 3
  • 8
  • 599
Anyone else had an issue if you have a BottomSheetDialogFragment with a ComposeView in the onCreateV...
n

nlindberg

over 3 years ago
Anyone else had an issue if you have a BottomSheetDialogFragment with a ComposeView in the onCreateView that has a column with vertical scroll, that you cant scroll the content up without first doing a motion to scroll it down? (it drags the dialog down instead of scrolling the content up). I would assume that the scrollview would intercept the drag and scroll and not pass it to the parent dialog for dragging?
n
j
+2
  • 4
  • 8
  • 599
Hey. I want to call a ViewModel function only ONCE in a composable. e.g. viewModel.getMovies() It sh...
j

Jeff

over 4 years ago
Hey. I want to call a ViewModel function only ONCE in a composable. e.g. viewModel.getMovies() It should not be called on re-composition. How do I achieve this?
j
m
k
  • 3
  • 5
  • 599
java.time.Duration vs kotlin.time.Duration? Is there a good reason to prefer one over the other? I n...
t

Travis Griggs

over 2 years ago
java.time.Duration vs kotlin.time.Duration? Is there a good reason to prefer one over the other? I need to work with both those and Instants (which I don't think Kotlin has it's "own" version of yet, and java.time.Instant is still the goto there).
t
m
  • 2
  • 1
  • 598
I’m trying to add a nullable `@RequestParam` of type `Int`, but get ``` "Optional int parameter 'p'...
o

oskarh

about 8 years ago
I’m trying to add a nullable
@RequestParam
of type
Int
, but get
"Optional int parameter 'p' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type."
Any way I can force Kotlin to use the wrapper class Integer instead of the primitive type?
o
c
  • 2
  • 6
  • 598
Hi all :wave:. Trying to understand `LookaheadScope`. I checked <https://developer.android.com/refer...
k

Konstantin Klassen

over 2 years ago
Hi all 👋. Trying to understand
LookaheadScope
. I checked this example, added some logs and what I see is not what I would expect. So after
placementOffset
is defined, I log
target
and
placementOffset
, expecting that those would be different when content moves, but they are always the same. Because of that, I could also just remove
placementOffset
and replace its usage with
target
and the change animation would still work. So when moving content, should
intermediateLayout
be called once with: -
placementOffset
-> where the content was, and -
target
-> where the content will be or am I not understanding this correctly? Also in this example,
targetOffset
is never read and
offsetAnimation
is not remembered
k
b
+2
  • 4
  • 10
  • 597
In enums, its a convention to use SCREAMING_SNAKE_CASE, which I totally agree with. However, in the ...
m

Michael de Kaste

over 2 years ago
In enums, its a convention to use SCREAMING_SNAKE_CASE, which I totally agree with. However, in the process of making an enum typesafe, we have opted to rewrite it using sealed classes. Now, this sealed class with sealed children with objects is basically just a 'better' enum. writing the object with SCREAMING_SNAKE_CASE is not seen as best practice, but I feel like, in these cases, it should. Anyone agree/disagree?
m
j
+4
  • 6
  • 14
  • 597
Previous101102103Next

kotlinlang

A modern programming language that makes developers happier.

Powered by