https://kotlinlang.org
Join Slack
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
  • 1200
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
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
  • 1198
I don't really understand how to read / write files in okio 3 multiplatform (specifically on ios). A...
m

Michal Klimczak

almost 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
  • 1198
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
  • 1197
Hi, new to KMM. Wondering what the recommended approach to navigation is for a Android/iOS app targe...
s

Smorg

about 3 years ago
Hi, new to KMM. Wondering what the recommended approach to navigation is for a Android/iOS app target? Is there some kind of library that can be used to handle navigation on both platforms, or is it better to just handle navigation independently on each platform (since navigation is related to UI, and it's better to write UIs independently)?
s
a
+8
  • 10
  • 15
  • 1195
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
  • 1195
I want to extract the array data from the json response and store the data in my custom data class. ...
t

T

over 5 years ago
I want to extract the array data from the json response and store the data in my custom data class.
data class NewsData (

    val author: String, val title: String,
    val url: String, val publishedAt: String
)
class NewsViewModel : ViewModel() {

    // The internal MutableLiveData String that stores the most recent response
    private val _response = MutableLiveData<String>()

    // The external immutable LiveData for the response String
    val response: LiveData<String>
        get() = _response

    /**
     * Call getNewsData() on init so we can display status immediately.
     */
    init {
        getNewsData()
    }

    /**
     * Sets the value of the status LiveData to the News API status.
     */
    private fun getNewsData() {

        _response.value = NewsApi.retrofitService.getProperties().enqueue(
            object : Callback<ResponseBody> {
                override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
                    _response.value = "Failure: " + t.message
                    //Log.i("response", t.message)
                }

                override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
                    val root = JSONObject(response.body().toString())
                    val jsonArr = root.getJSONArray("articles")
                    val ob = jsonArr.getJSONObject(0)
                    val name = ob.getString("author")
                    _response.value = name
                }
            }).toString()
    }
}
This is the format of the json response.
t
o
  • 2
  • 19
  • 1194
Hello, I get this error. What is the reason? " error: @Binds methods' parameter type must be assign...
h

Hovhannes

over 4 years ago
Hello, I get this error. What is the reason? " error: @Binds methods' parameter type must be assignable to the return type public abstract com.example.data.network.AuthApi " in AppModule
@Module
@InstallIn(SingletonComponent::class)
abstract class AppModule {


    companion object {
        @Singleton
        @Provides
        fun provideRemoteDataSource(): RemoteDataSource {
            return RemoteDataSource()
        }



        @Singleton
        @Provides
        fun provideUserApi(
            remoteDataSource: RemoteDataSource,
      
        ): UserApi {
            return remoteDataSource.buildTokenApi()
        }

        @Provides
        fun provideAuthRepository(authApi: AuthApi): AuthRepository {
            return AuthRepository(authApi)
        }


        @Provides
        fun provideUserRepository(userApi: UserApi): UserRepository {
            return UserRepository(userApi)
        }
    }



        @Binds
        @Singleton
        abstract fun bindsRemoteDataSource(authRepository: AuthRepository): AuthApi
}
class AuthRepository @Inject constructor(private val api: AuthApi) : BaseRepository(api) {....}
h
a
  • 2
  • 8
  • 1193
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
  • 1190
Previous313233Next

kotlinlang

A modern programming language that makes developers happier.

Powered by