https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
android
  • n

    neuber

    04/24/2018, 7:31 PM
    ie the package name must be separated by line and I am not able to do this
    b
    • 2
    • 3
  • b

    brainail

    04/25/2018, 10:23 AM
    Hi everyone 🙂 Was anybody able to use PowerMock + Kotlin + plain junit4 + backticks for all methods? For the first run everything was great but then nothing works again, javassist sometimes logs strange errors about bytecode or methods merely can’t be found by JUnit4TestRunnerXXX.., or Android Studio and even gradle task via console aren’t able to find any tests even if some test should be failed. I’m interested in backticks usage. It seems like transformation of such method to Java bytecode + bytecode manipulations of PowerMock break everything… I know that there is
    test
    channel but I think it’s can be more general problem. When for instance I have more than 10 tests written with backticks then nothing works (via gradle too) with the following error:
    java.lang.IllegalStateException: Failed to transform class with name com.X.X.X.SenderTest. Reason: [source error] ) is missing
    
    	at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:284)
    	at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:192)
    	at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass1(DeferSupportingClassLoader.java:77)
    	at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:348)
    	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:161)
    	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:48)
    	at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:108)
    	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:71)
    
    Caused by: compile error: ) is missing
    	at javassist.compiler.Parser.parsePrimaryExpr(Parser.java:1250)
    	at javassist.compiler.Parser.parsePostfix(Parser.java:1031)
    	at javassist.compiler.Parser.parseCast(Parser.java:921)
    	at javassist.compiler.Parser.parseUnaryExpr(Parser.java:886)
    g
    o
    • 3
    • 24
  • b

    brainail

    04/25/2018, 10:24 AM
    I thought that at least Kotlin plus tests will work smoothly really but seems like such thing like backticks breaks everything in tests…
    g
    • 2
    • 9
  • a

    Ayden

    04/26/2018, 9:39 AM
    Most of them is Java.
    a
    • 2
    • 2
  • a

    adam-mcneilly

    04/26/2018, 5:15 PM
    Is it possible to call Kotlin function types via data binding in Android? https://stackoverflow.com/questions/50048645/calling-kotlin-function-type-from-databinding-android/50048646#50048646
    b
    g
    • 3
    • 3
  • j

    jakubgruber

    04/26/2018, 8:00 PM
    Hi, does anyone faced following issue?
    Detected problems with app native libraries 
    (please consult log for detail):
    libavcodec.so: text relocations
    libswresample.so: text relocations
    I do not use any native libraries. This happens on one screen on x86 device, so it's quite difficult to debug as I do not have one. I suspect Mobile Vision API or AWS SDK, but I use both in the latest versions. I found that in Android 7, they stopped allowing developers to linking to native libraries and therefore they need to pack application with libraries included, but I cannot influence what my libraries use. Any suggestions, please? :))
    :stackoverflow: 1
    n
    l
    • 3
    • 8
  • r

    rattleshirt

    04/27/2018, 7:54 AM
    Anyone who also ran into
    SkeletonDatabase.java:7: error: android.arch.persistence.room.RoomProcessor was unable to process this class because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
    in a module with AS 3.1.1, kotlin 1.2.40, gradlew 4.7, room 1.1.0-beta3, android gradle plugin 3.1.1? Already tried to downgrade versions but without any luck. It doesn’t look similar to the embeddable issue that was posted earlier.
    g
    • 2
    • 11
  • w

    wilyarti

    04/28/2018, 3:15 PM
    I have figured out the above issue by running intensive loads on a CommonPool thread. This has caused another issue. Because the Callback from my .aar file is on a CommonPool thread I can't use the Callback to update the UI. So is there a way to shuffle the Callback into the UI thread via some kind of function?
    • 1
    • 1
  • r

    r-z

    04/28/2018, 3:22 PM
    I've got a fragment and I'm trying to get the dimensions of an Image view inside that fragment as soon as the fragment is loaded, but I keep getting 0*0. Any hints on how this could be done?
    :stackoverflow: 3
    d
    • 2
    • 1
  • r

    Ravi.Rajjak

    04/28/2018, 4:17 PM
    I just want to set adapter in recylerview . But app is getting crashed and no log is found
    g
    • 2
    • 1
  • a

    Ana Stu

    04/29/2018, 2:18 PM
    call.enqueue(new Callback<List<Task>>() { @Override public void onResponse(Call<List<Task>> call, Response<List<Task>> response) { if (response.isSuccessful()) { // tasks available } else { // error response, no access to resource? } } @Override public void onFailure(Call<List<Task>> call, Throwable t) { // something went completely south (like no internet connection) Log.d("Error", t.getMessage()); } }
    g
    • 2
    • 1
  • a

    Andrea

    04/30/2018, 9:01 AM
    hey guys I'm having a problem that I'm not able to understand
    :stackoverflow: 1
    e
    g
    • 3
    • 3
  • a

    Andrea

    04/30/2018, 9:01 AM
    is there someone that can help me online?
    :stackoverflow: 1
    g
    • 2
    • 3
  • a

    Andrea

    04/30/2018, 9:09 AM
    FATAL EXCEPTION: main Process: com.example.utente.lets_appv0, PID: 8477 java.lang.IllegalArgumentException: Capacity: -8
    :stackoverflow: 1
    g
    • 2
    • 7
  • a

    Andrea

    04/30/2018, 9:12 AM
    I'm devolping an application that connects via bluetooth to PCB and plot in real time an acquired ECG. While navigating back to my main activity and going again to the monitoring activity the application crashes with this error
    :stackoverflow: 7
    👎 1
    d
    • 2
    • 1
  • w

    wilyarti

    04/30/2018, 1:58 PM
    I wrote a quick overview of what I learned getting Go working with Kotlin utilising callbacks and coroutines: https://clinetworking.wordpress.com/2018/04/30/building-a-kotlin-android-app-with-go-logic/ I also created an example app which is linked in the blog post for those who want to get started quickly. Happy to hear any feed back. My main goal is to help someone else get started easier.
    👏 3
    c
    • 2
    • 3
  • e

    Erfan

    05/01/2018, 12:14 PM
    Guys how do I add
    volley
    to my project in Android Studio 3.1.2? I try with
    implementation 'com.android.volley:volley:1.1.0'
    but it fails with the following errors:
    Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
    Open File
    Show Details
    
    
    Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
    Open File
    Show Details
    
    
    Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
    Open File
    Show Details
    
    
    Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
    Open File
    Show Details
    
    
    Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.volley:volley:1.1.0.
    Open File
    Show Details
    p
    d
    +2
    • 5
    • 10
  • j

    jakubgruber

    05/02/2018, 7:26 AM
    Hi guys, it’s not 100% Kotlin question, but does anyone have experience with using elliptic curve keys in Android below API 23? I cannot import the keys that I generated outside a keystore into the keystore and therefore I tried to generate them directly in there. Unfortunately, I found out that Android does not support EC for API below 23. Any suggestion how to overcome this issue, please?
    :stackoverflow: 4
    g
    • 2
    • 5
  • s

    Sudhir Singh Khanger

    05/02/2018, 7:40 AM
    private lateinit var movieAdapter: RecyclerView.Adapter<*>
    private lateinit var movieAdapter: MovieAdapter
    What is the difference between declaring type as the exact class of name
    MovieAdapter
    and
    RecyclerView.Adapter<*>
    ? Also what does it mean by the asterix
    <*>
    ? Which one is better?
    e
    g
    • 3
    • 2
  • i

    Imran

    05/02/2018, 5:27 PM
    Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: unresolved supertypes: rx.Observer, Can anyone please guide me where i am wrong or miss something
    g
    • 2
    • 1
  • i

    Imran

    05/03/2018, 7:59 AM
    yes i have added all the dependency related to RXJava and RXAndroid but don't know where this error pointing out
    e
    • 2
    • 1
  • j

    jw

    05/03/2018, 7:45 PM
    this isn't kotlin-related
    s
    i
    • 3
    • 2
  • o

    orangy

    05/03/2018, 8:05 PM
    This entire Slack is about Kotlin…
    ☝️ 3
    :kotlin: 11
    e
    • 2
    • 6
  • j

    jw

    05/03/2018, 9:32 PM
    If the name of the slack organization doesn't stop people from going off topic, I'm not convinced a channel name would either.
    and this conversation is evidence of that! (needs #meta)
    🤣 1
    a
    o
    • 3
    • 3
  • g

    ghosalmartin

    05/04/2018, 10:30 AM
    i mean youd assume the slack group name was name spacing it, kotlinlang-android
    g
    • 2
    • 1
  • n

    neuber

    05/04/2018, 12:20 PM
    https://github.com/neuberfran/Marvel/tree/master/erros
    l
    e
    a
    • 4
    • 15
  • j

    Jimmy Alvarez

    05/04/2018, 8:28 PM
    hello guys, I'm a tester and I'm facing a very good opportunity to jump to android development. I have experience programming but actually I want to learn the basics of android, any one here has a book that help me understand android development but in kotlin off course
    m
    t
    +2
    • 5
    • 6
  • s

    Slackbot

    05/05/2018, 5:46 PM
    This message was deleted.
    😂 1
    :trollface: 2
    👎 2
    :stackoverflow: 4
    p
    • 2
    • 1
  • d

    Davor Maric

    05/05/2018, 11:38 PM
    Hey guys.. anyone else facing this problem with kotlin-kapt? https://issuetracker.google.com/issues/74537216
    ➕ 1
    r
    • 2
    • 3
  • s

    spierce7

    05/06/2018, 2:55 AM
    I don't find Kotlin class delegates very useful. I've found many uses for property delegates, but I have never found the class delegation in Kotlin to be what I needed. I've been programming in Kotlin for almost 4 years, and haven't used it once. Has anyone found it to be useful, and can they explain how they use it?
    d
    p
    +4
    • 7
    • 17
Powered by Linen
Title
s

spierce7

05/06/2018, 2:55 AM
I don't find Kotlin class delegates very useful. I've found many uses for property delegates, but I have never found the class delegation in Kotlin to be what I needed. I've been programming in Kotlin for almost 4 years, and haven't used it once. Has anyone found it to be useful, and can they explain how they use it?
d

drofwarcs

05/06/2018, 3:15 AM
I also have a hard to finding a good use for this feature. In my case, its turns out that this feature is really a form of the Decorator pattern instead of just a plan delegate pattern, which is why the class thats using
by
must also conform to the interface. If there was a similar kotlin feature like this that did not implement/conform the interface methods in the class using
by
, I would be using this like crazy. The current way it works comes in handy for places where you would use the decorator pattern.
p

pankajrai

05/06/2018, 4:12 AM
Yes it is extremely useful for example by lazy delegate which does object initialization when its used for the first time thereafter directly use its value. Observer/Vetoable are great way to observer value and restrict what value should be assigned to an object.
lazy initialization make your object immutable that means no overhead included to allocate space for variable memory as its value never change
t

trevjones

05/06/2018, 4:19 AM
I typically only use it as a way to reduce code duplication around things like rx disposable management or viewholder code where a custom view isn’t any more appropriate. ie)
Foo(...): DisposeBucket by DisposeBucket.Impl()
👍 1
k

kenkyee

05/06/2018, 10:16 AM
Why wouldn't you use it for class composition?
r

rkeazor

05/06/2018, 3:04 PM
I found it useful
It favors composition over inheritance. I think the problem most people have , is that they are used to the inheritance model so its can be somewhat weird to wrap your head around
👍 2
in essence you can delegate the actual implmentation of Object. so for instance, in a normal MVP(passive view flavor) architecture you would have a interfaces that seperate the layer of abstraction between the presenter and Activity. However you would have to have the actual implementation as a instance variable
in both the activity and the presenter. but class delegation removes this need
The only downside I see with it , was perhaps the same downside you get from Multiple inheritance, and default methods..Is that if you do it to much you don’t know where things are coming from lmaoo
but i think its a cool feature
s

spierce7

05/06/2018, 7:26 PM
Every time I use it, I find it's limitations crippling. I've seen 2 uses for it 1. When I want to delegate all methods from an interface to another class, but then I'm asking myself why am I not just extending the class, since this 95% of the time, the class definitely won't be extending anything else. I agree learned to favor composition over inheritance, but the limitations of the class delegate in Kotlin have ensured that I can't use it for that in all the instances I've come across. 2. If I split an interface into multiple smaller interfaces, and then kind of patched implementations together of the implementations using the class delegates. I could see it useful for this, effectively using this as a decorator pattern of some sort. I'm not sure if this would actually work well though. I'm sure it is useful, I just haven't seen a way that I've found it to be useful. I'm confident that if someone showed me a real example of how its been useful for them it would probably grow me as a programmer, as I think it's likely there is just a mental block there now.
r

rkeazor

05/06/2018, 11:52 PM
yea you can extend it, but remember Java and Kotlin favor single Inheritance.So if you have a class that extends a base class, and you want to inherit from another class as well, you will have to create a instance variable of that class
l

louiscad

05/08/2018, 8:04 AM
I found a very compelling use case for it on Android that also involves companion objects. I'll share it back here this week (or maybe today)
Here's what you can do with interface implementation delegates, companion objects, and reified type parameters for Android
s

spierce7

05/21/2018, 2:23 PM
?
l

louiscad

05/21/2018, 2:45 PM
Oh… silly me, forgot the link… Here it is: https://github.com/LouisCAD/Splitties/blob/master/intents/README.md @spierce7 Feel free to jump straight to the example
View count: 1