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
  • l

    Lilly

    07/23/2021, 12:21 PM
    Disclaimer: It's not really Kotlin related, be lenient. I have a multi module project with some android library modules. I want to reuse the modules in other projects but currently none of them are pushed to git or published to a maven repository. I know it's possible to publish the modules to a maven repository within the main project but I'm wondering what I can do to have each module in git as single project so I can develop each module in isolation. The only solution I'm aware of is to create a new project for every module I want to have as a single project and copy the specific source files over. Is there a shorter way of doing this?
    🤷 1
    j
    l
    k
    • 4
    • 18
  • h

    Hovhannes

    07/23/2021, 1:59 PM
    I use java.util.Base64.getEncoder() in Kotlin, but on below of Nougat versions doesn't work. I get this error on below of Nougat versions "Failed resolution of: Ljava/util/Base64"
    :not-kotlin: 2
    m
    s
    • 3
    • 4
  • d

    Danish Ansari

    07/24/2021, 9:21 PM
    Can someone please help me with this? https://stackoverflow.com/questions/68511430/jackson-serialisation-fails-by-throwing-kotlinreflectioninternalerror-when-seria
    b
    • 2
    • 1
  • s

    Sudhir Singh Khanger

    07/25/2021, 2:53 AM
    What happens when a
    View
    is in
    GONE
    state and
    LiveData
    is supposed to set value on it? Does
    LiveData
    do anything or skip setting value or does it set it but since the view is gone we won't be able to see changes?
    :not-kotlin: 1
    k
    • 2
    • 3
  • r

    ritesh

    07/25/2021, 6:31 AM
    In many android projects, I observed
    kotin stdlib
    dependency is added in the Gradle files. I also observed 
    kotlin
     and 
    kotlin-android
     plugin also adds it by default. I am assuming adding it manually can be avoided? Or is there a downside to it?
    org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}
    e
    • 2
    • 2
  • r

    ritesh

    07/25/2021, 6:37 AM
    Also, I believe
    android {
      ...
      compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
      }
    
      kotlinOptions {
        jvmTarget = "1.8"
      }
    }
    compileOptions
    can be safely dropped from 100% kotlin application. Using
    kotlinOptions.jvmTarget="11"
    is there a downside to it, in terms of byte-code generation and byte-code compatibility with other jdk versions.
    e
    • 2
    • 5
  • d

    Danish Ansari

    07/25/2021, 11:47 AM
    Anyone?
    • 1
    • 1
  • a

    andylamax

    07/26/2021, 2:48 AM
    how do I set
    lintOptions {
            isAbortOnError = false
        }
    In AGP 7.0.0-alpha01 using kotlin-dsl? The above snipet works with AGP 4.1.3, it fails when upgraded to 7.0.0
    c
    • 2
    • 3
  • l

    Loredana Petrea

    07/26/2021, 6:55 AM
    Hi 👋 Updating kotlin to 1.5.0 I get this error
    java.lang.NoSuchMethodError: No static method getSeconds(I)D in class Lkotlin/time/DurationKt; or its super classes (declaration of 'kotlin.time.DurationKt'
    I removed the
    kotlin-stdlib
    explicit declaration but the error is still here. I appreciate any help
    g
    • 2
    • 9
  • j

    juliocbcotta

    07/26/2021, 9:00 AM
    In Android projects we don’t apply the
    java
    plugin , do we have something similar to
    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(11)
            vendor = JvmVendorSpec.ADOPTOPENJDK
        }
    }
    In the AGP or kotlin plugin ?
    g
    • 2
    • 2
  • s

    Scott Kruse

    07/26/2021, 5:15 PM
    With HILT being publicly endorsed by google as the recommended DI framework, and dagger getting some key new features this year like assisted injection. Is there any reason to continue using Koin / Kodein for android? If you have multiplatform ambitions for your existing codebase, how might you approach DI?
    :kotlinnew: 3
    :not-kotlin: 6
    k
    j
    +3
    • 6
    • 22
  • a

    alex.tavella

    07/27/2021, 4:41 PM
    [Jetpack Proto DataStore]
    Is there any option to generate kotlin instead of Java-lite on the gradle plugin? The java option does not use nullable annotation so I find it a bit error-prone to consume from kotlin for new devs.
    protobuf {
      protoc {
        artifact = 'com.google.protobuf:protoc:3.8.0'
      }
      generateProtoTasks {
        all().each { task ->
          task.builtins {
            java {
              option "lite"
            }
          }
        }
      }
    }
    • 1
    • 1
  • r

    Rooparsh

    07/28/2021, 3:52 AM
    Hi all, I have a general query to ask for Activity Contract API. Is there any way, we can write custom Contracts for 3rd Party Libraries that still uses
    startActivityForResult
    and overrides
    onActivityResult
    . I am using Google Pay Wallet SDK and it has a function which simply accepts request code and internally calls
    startActivityForResult
    . Can I do something at my end to make the code more modular using ActivityContracts? Attaching sample code in thread.
    :not-kotlin: 6
    j
    • 2
    • 3
  • g

    gabriel dean

    07/28/2021, 8:33 AM
    Hi everyone, I heard that Jetpack compose was released 1.0 version. It's really great, but someone can tell me how can I create recyclerview with flexboxLayoutManager by jetpack compose. Thanks you all, have a nice day
    c
    m
    • 3
    • 3
  • b

    BlaceShell

    07/29/2021, 6:52 AM
    In Android development, how can I get the cover of the music being played by a third-party music player?
    :not-kotlin: 13
    z
    • 2
    • 1
  • p

    Peter Mandeljc

    07/29/2021, 7:14 PM
    Hey guys, I'm considering using ktor for rest client, instead of Retrofit. Do you mind sharing any opinions on that topic? I'm also interested in unit testing.
    m
    c
    +3
    • 6
    • 11
  • d

    Doni Winata

    07/30/2021, 2:34 AM
    Hi i want to passing this kotlin argument only for my unit test build
    kotlinOptions {
        freeCompilerArgs += [
                '-Xsam-conversions=class',
        ]
    }
    Any one have clue how i can achieve it ? Thank you in advance
    e
    j
    • 3
    • 5
  • v

    Vivek Modi

    07/30/2021, 9:56 AM
    Hey I want to convert cm to feet. i create the logic it's working fine, but problem is if i enter 152 cm it convert into 4'12", i don't want to show like that. instead i want to show 5 foot.
    private fun cmToFeet(value: String): String {
        var text = ""
        val cm = value.toDouble()
        val feet = floor((cm / 2.54) / 12)
        val inches = round((cm / 2.54) - (feet * 12))
        if (feet > 0 && feet < 10) {
            text = "${feet.toInt()}'"
            if (inches > 0) {
                text += "${inches.toInt()}\""
            }
        }
        return text
    }
    b
    • 2
    • 2
  • b

    BlaceShell

    07/30/2021, 10:35 AM
    hi ,i meet some trouble . how can i record a video in my android app, or record a video in the CustomView ??
    :not-kotlin: 10
    l
    • 2
    • 2
  • n

    Noushad Chullian

    07/31/2021, 2:16 PM
    can anyone suggest best way to modularize an app which is currently developing, like which which sections can be separated?
    :not-kotlin: 7
    t
    • 2
    • 1
  • l

    Law Gimenez

    07/31/2021, 3:16 PM
    Hi guys, I'm not sure if this is the right place. I submitted an aab file on Play Store for a major update. This was my first aab upload, but users can't download or update my app from the App Store. I'm not sure what went wrong. On Play Store console it indicated that the rollout was good and full. Thank you! Anyone have similar questions experience?
    :stackoverflow: 1
    :not-kotlin: 4
    z
    • 2
    • 1
  • c

    Christopher Elías

    07/31/2021, 4:47 PM
    Hello guys, does someone else is going through this kind of issue? the IDE seems to not recognize the imports (Jetchat from the Google Compose samples) on the new Android Arctic Fox. It show the highlight as error but when hit compile & run it deploys to the emulator/connected device with no problems.
    j
    • 2
    • 2
  • p

    P

    07/31/2021, 11:22 PM
    Hi Everyone, I'm Precious and I'm totally new to Kotlin and software development in general. I recently got a scholarship from Google to study Android development and I'll want to use the opportunity to up skill as much as possible. So I put together a community and a challenge for people who are totally new to Kotlin and are interested in spending the next 31 day to learn the basics of the language. Clearly, most people in this community have been using Kotlin for a long, long time and may want to offer a hand as mentors. If this is your thing, please feel free to message me here bit.ly/Hi-Precious I will be eternally grateful if you do. P.S Hopefully this does not go against any community rules, but if it does, I'm very sorry and will happily take it down on first prompt. Cheers.
    :kotlinnew: 6
    c
    • 2
    • 2
  • a

    Arpan Sarkar

    08/01/2021, 6:06 PM
    This class which basically does validation on input fields. Using 
    LiveData
     to how can i convert the 
    MediatorLiveData
     part to 
    StateFlow
    import androidx.lifecycle.LiveData
    import androidx.lifecycle.MediatorLiveData
    import androidx.lifecycle.MutableLiveData
    
    abstract class InputFrom {
        private val _isFromValid = MediatorLiveData<Boolean>()
        val isFromValid: LiveData<Boolean>
            get() = _isFromValid
    
        abstract val fields: List<LiveInputField<*>>
    
        fun init() {
            fields.forEach { inputField ->
                _isFromValid.addSource(inputField.value) { changedValue ->
                    inputField.validate(changedValue)
                    _isFromValid.value = fields.all {
                        it.isValid
                    }
                }
            }
        }
    
        inner class LiveInputField<T>(
            private val errorMessage: String? = null,
            private val predicate: (T?) -> Boolean
        ) {
    
            val value = MutableLiveData<T>()
    
            private val _error = MutableLiveData<String>()
            val errorText: LiveData<String>
                get() = _error
    
            var isValid: Boolean = false
    
            fun validate(value: Any?) {
                @Suppress("UNCHECKED_CAST")
                return if (predicate(value as? T)) {
                    _error.value = null
                    isValid = true
                } else {
                    _error.value = errorMessage
                    isValid = false
                }
            }
        }
    }
    Example Usages:
    class LoginFrom : InputFrom() {
    
        val username =
            LiveInputField<String>("At least 4 characters, only letters, numbers, ., _ allowed.") {
                !it.isNullOrBlank() &&
                    Pattern.compile("[a-zA-Z0-9_.]{4,}")
                        .matcher(it)
                        .matches()
            }
    
        val password =
            LiveInputField<String>(
                "8 characters or more, at least one number, one uppercase, one lowercase."
            ) {
                !it.isNullOrBlank()/* &&
              Pattern.compile("((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,})")
                  .matcher(it)
                  .matches()*/
            }
    
        override val fields: List<LiveInputField<*>>
            get() = listOf(
                username,
                password
            )
    }
    • 1
    • 1
  • h

    Hovhannes

    08/02/2021, 1:08 PM
    Hello, how can we pass EditText's value to another class (not activity/fragment) using MVVM?
    :not-kotlin: 3
    s
    s
    • 3
    • 5
  • v

    Viral Thakker

    08/02/2021, 2:33 PM
    Hello Everyone, I am getting an issue with Kotlin Hilt Here's what I am doing right now, I have made one test class and needs to be injected in view model, Also wrote provides in component module. Now I am injecting it in a viewmodel via @inject lateinit var test:TestInterface, now when I am trying to use the variable test, it gives the lateinit var has not initialized , can anyone suggest what is missing ?
    j
    • 2
    • 3
  • r

    ritesh

    08/02/2021, 6:06 PM
    Any easy way to know, which is the current displayed fragment from android studio? I can get the activity name from profiler, but finding it hard time with fragment.
    :not-kotlin: 9
    s
    s
    a
    • 4
    • 5
  • p

    pollux-

    08/02/2021, 10:41 PM
    ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsets ->
        val statusBarInsets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars())
        val statusBarHeight: Int = <http://statusBarInsets.top|statusBarInsets.top>
    }
    Does anyone knows, why I’m I getting statusBar height as zero, this will be called multiple times, sometimes I see the actual height of the status bar but sometimes it does reset to zero. Appreciate your help
    l
    • 2
    • 1
  • a

    Alan Yin

    08/03/2021, 5:54 AM
    Type inference failed, how to fix?
    g
    s
    • 3
    • 7
  • y

    Yaniv Sosnovsky

    08/03/2021, 11:17 AM
    Hi guys. I have an android sdk project that I upload to Github packages using maven plugin for Android Studio. Is there any way to not publish the sources.jar? I want my source code to remain hidden for the SDK consumers… This is my gradle part
    publishing {
        repositories {
           
            maven {
                name = "GithubPackages"
                url = uri("<https://maven.pkg.github.com/>...")
                credentials {
                    username = "..."
                    password = "..."
                }
            }
        }
    }
    v
    n
    • 3
    • 38
Powered by Linen
Title
y

Yaniv Sosnovsky

08/03/2021, 11:17 AM
Hi guys. I have an android sdk project that I upload to Github packages using maven plugin for Android Studio. Is there any way to not publish the sources.jar? I want my source code to remain hidden for the SDK consumers… This is my gradle part
publishing {
    repositories {
       
        maven {
            name = "GithubPackages"
            url = uri("<https://maven.pkg.github.com/>...")
            credentials {
                username = "..."
                password = "..."
            }
        }
    }
}
v

Vitaliy Zarubin

08/03/2021, 11:42 AM
The global properties file should be located in your home directory: • On Windows: C:\Users\<you>\.gradle\gradle.properties • On Mac/Linux: /Users/<you>/.gradle/gradle.properties
y

Yaniv Sosnovsky

08/03/2021, 11:48 AM
Thanks, but I cant find that file…. 😞
v

Vitaliy Zarubin

08/03/2021, 11:49 AM
Create a new file
n

Nikolay Puliaev

08/03/2021, 12:29 PM
@Vitaliy Zarubin how will it help us to prevent users from downloading jars itself? Anyway they download source code while using dependency, so it could be decompiled or broken in any other way. Am I wrong?
v

Vitaliy Zarubin

08/03/2021, 12:34 PM
This is an assembly, there will be no passwords in the jar, they are needed only for assembly
This will clear the repository from passwords.
y

Yaniv Sosnovsky

08/03/2021, 12:36 PM
Yeah. This is still unclear to me. I still don’t understand how to ‘tell’ maven not to create sources.jar and upload it. I’m currently trying to disable the Sources.jar tasks. I’ll update if this works… thanks guys for your help
n

Nikolay Puliaev

08/03/2021, 12:37 PM
I still don’t understand how to ‘tell’ maven not to create sources.jar and upload it
I’m not sure it is possible. Dependency can’t work without source code, because it’s compiling in build time.
The only thing you can try is obfuscation, to make your sources barely readable.
Or I’ve missed the initial problem?
y

Yaniv Sosnovsky

08/03/2021, 12:39 PM
I tried to do that but it didn’t seem to work (I’m not sure but it seems like the obfuscation only happens after the sources are generated)
n

Nikolay Puliaev

08/03/2021, 12:40 PM
I’m not sure but it seems like the obfuscation only happens after the sources are generated
Don’t really know about it.
v

Vitaliy Zarubin

08/03/2021, 12:40 PM
Сredentials are only needed to get dependencies, not for the application to work. there should be no passwords in the build. If this is not the case, I will be surprised)
y

Yaniv Sosnovsky

08/03/2021, 12:42 PM
The credentials are not the problem, we want to keep the repo private, but just hide the sources…
➕ 1
v

Vitaliy Zarubin

08/03/2021, 12:46 PM
By the same logic - repo is needed to get the dependency. I don't think they somehow figure in the finished build.
y

Yaniv Sosnovsky

08/03/2021, 12:46 PM
I looked at the build process for publishing and I saw that the first two stages are generating the sources, and the minify only happens near the end.. I’m not an expert on the subject but it feels very strange to me… • :core:androidDebugSourcesJar • :core:androidReleaseSourcesJar • :core:preBuild • :core:extractProguardFiles • :core:preDebugBuild • :core:compileDebugAidl • :core:mergeDebugJniLibFolders • :core:mergeDebugNativeLibs • :core:stripDebugDebugSymbols • :core:copyDebugJniLibsProjectAndLocalJars • :core:compileDebugRenderscript • :core:generateBuildKonfig • :core:generateDebugBuildConfig • :core:generateDebugResValues • :core:generateDebugResources • :core:packageDebugResources • :core:parseDebugLocalResources • :core:processDebugManifest • :core:javaPreCompileDebug • :core:mergeDebugShaders • :core:compileDebugShaders • :core:generateDebugAssets • :core:packageDebugAssets • :core:packageDebugRenderscript • :core:prepareLintJarForPublish • :core:processDebugJavaRes • :core:writeDebugAarMetadata • :core:preReleaseBuild • :core:compileReleaseAidl • :core:mergeReleaseJniLibFolders • :core:mergeReleaseNativeLibs • :core:stripReleaseDebugSymbols • :core:copyReleaseJniLibsProjectAndLocalJars • :core:compileReleaseRenderscript • :core:generateReleaseBuildConfig • :core:generateReleaseResValues • :core:generateReleaseResources • :core:packageReleaseResources • :core:parseReleaseLocalResources • :core:processReleaseManifest • :core:javaPreCompileRelease • :core:mergeReleaseShaders • :core:compileReleaseShaders • :core:generateReleaseAssets • :core:packageReleaseAssets • :core:packageReleaseRenderscript • :core:processReleaseJavaRes • :core:writeReleaseAarMetadata • :core:generatePomFileForAndroidPublication • :core:generateDebugRFile • :core:generateDebugLibraryProguardRules • :core:generateReleaseRFile • :core:generateReleaseLibraryProguardRules • :core:compileDebugKotlinAndroid • BufferingMeter.kt • ‘when’ expression on enum is recommended to be exhaustive, add ‘STATE_IDLE’, ‘STATE_ENDED’ branches or ‘else’ branch instead • ‘when’ expression on enum is recommended to be exhaustive, add ‘STATE_IDLE’, ‘STATE_ENDED’ branches or ‘else’ branch instead • ‘when’ expression on enum is recommended to be exhaustive, add ‘STATE_IDLE’, ‘STATE_ENDED’ branches or ‘else’ branch instead • ‘when’ expression on enum is recommended to be exhaustive, add ‘STATE_IDLE’, ‘STATE_ENDED’ branches or ‘else’ branch instead • CoViewClientImpl.kt • MessengerFeatureImpl.kt • RoomStateSerializer.kt • PositionSynchronizer.kt • :core:compileDebugJavaWithJavac • :core:extractDebugAnnotations • :core:mergeDebugGeneratedProguardFiles • :core:mergeDebugConsumerProguardFiles • :core:mergeDebugJavaResource • :core:compileReleaseKotlinAndroid • :core:compileReleaseJavaWithJavac • :core:extractReleaseAnnotations • :core:mergeReleaseGeneratedProguardFiles • :core:mergeReleaseConsumerProguardFiles • :core:mergeReleaseJavaResource • :core:minifyDebugWithR8 • :core:syncDebugLibJars • :core:bundleDebugAar • :core:minifyReleaseWithR8 • :core:syncReleaseLibJars • :core:bundleReleaseAar • :core:generateMetadataFileForAndroidPublication • :core:publishAndroidPublicationToMavenLocal
Seems like skipping the tasks actually did the trick. Feels like a terrible hack but I guess it will do for now. just added this to the end of the gradle file :
tasks.whenTaskAdded {
    if (name.contains("SourcesJar")) {
        this.enabled = false
    }
}
If anyone knows of a better way, please share. Thanks everybody 😀 worth mentioning the the gradle file is in kotlin
n

Nikolay Puliaev

08/03/2021, 1:06 PM
And how users will use your sdk then?
Does it works?
y

Yaniv Sosnovsky

08/03/2021, 1:08 PM
Yeah, I looked in the github packages page and there is no sources.jar
The api for the SDK is still available, they just can’t see the source files themselves
n

Nikolay Puliaev

08/03/2021, 1:10 PM
🤯
🙂 1
How is that possible...
Can you explain, how is it possible to use sdk api without api itself?
v

Vitaliy Zarubin

08/03/2021, 1:12 PM
I don't think you can remove sdk api and have it at the same time
n

Nikolay Puliaev

08/03/2021, 1:16 PM
Yes, so what do we have: 1. Yaniv removed sdk sources, so that means removed api too 2. It is possible to use api 3. Api doesn't exists 4. 🤯
y

Yaniv Sosnovsky

08/03/2021, 1:17 PM
The api is still there. The sdk is compiled and uploaded as an aar file to github.
it’s looks like this
private const final val TAG: kotlin.String /* compiled code */
it’s still there, but you can’t see the implementation…
n

Nikolay Puliaev

08/03/2021, 1:19 PM
Ohhhhh damned
I got you
😄 1
y

Yaniv Sosnovsky

08/03/2021, 1:19 PM
and there is no ‘download sources’ from the android studio
n

Nikolay Puliaev

08/03/2021, 1:19 PM
This is solved with minimization
y

Yaniv Sosnovsky

08/03/2021, 1:20 PM
minify = true? I tried but the sources.jar was still uploaded and that wasn’t minified
so when Android studio suggests ‘download sources’ it would download the sources and show the implementation… really annoying
n

Nikolay Puliaev

08/03/2021, 1:21 PM
Hmmm I think that exactly what Vitaliy was talking about - gradle.properties
y

Yaniv Sosnovsky

08/03/2021, 1:23 PM
umm… I think that only works locally, it would not work for some client who tries to consume the sdk. I could be wrong though..
n

Nikolay Puliaev

08/03/2021, 1:25 PM
Don't know, I have this enabled in my SDK, but don't remember how exactly - can't take a look now, because out of pc
View count: 22