Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find "org.jetbrains.compose.collection-internal:collection" when running Task :composeApp:compileKotlinIosSimulatorArm64 #251

Open
hafiz013 opened this issue Apr 17, 2024 · 0 comments

Comments

@hafiz013
Copy link

Below here details error:

> Task :composeApp:compileKotlinIosSimulatorArm64 FAILED
error: Could not find "org.jetbrains.compose.collection-internal:collection" in [/Users/mohdhafiz/Downloads/AssetManagementSystem, /Users/mohdhafiz/.konan/klib, /Users/mohdhafiz/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.21/klib/common, /Users/mohdhafiz/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.21/klib/platform/ios_simulator_arm64]
error: Compilation finished with errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':composeApp:compileKotlinIosSimulatorArm64'.
> Compilation finished with errors

Below here my setup:

     commonMain.dependencies {
        implementation(libs.paging.compose.common)
     }
}```

inside lib.versions.toml:
paging-compose-common = { module = "app.cash.paging:paging-compose-common", version.ref = "3.3.0-alpha02-0.5.1" }

Sample setup code:
```open class ResultPagingSource<T : Any>(private val pagingData: suspend (page: Int, pageSize: Int) -> ResultWrapper<List<T>>) :
    PagingSource<Int, T>() {

    override fun getRefreshKey(state: PagingState<Int, T>): Int? = null

    override suspend fun load(params: LoadParams<Int>): LoadResult<Int, T> =
        (params.key ?: 1).let { _page ->
            try {
                pagingData(_page, params.loadSize)
                    .run {
                        when(this){
                            is ResultWrapper.Success ->{
                                LoadResult.Page(
                                    data = value,
                                    /* no previous pagination int as page */
                                    prevKey = _page.takeIf { it > 1 }?.dec(),
                                    /* no pagination if no results found else next page as +1 */
                                    nextKey = _page.takeIf { value.size >= params.loadSize }?.inc()
                                )
                            }
                            is ResultWrapper.NetworkError ->{
                                LoadResult.Error(this.throwable)
                            }
                            is ResultWrapper.Failure ->{
                                LoadResult.Error(Throwable(this.error?.message ?: ""))
                            }
                        }
                    }
            } catch (e: Exception) {
                LoadResult.Error(e)
            }
        }
}```

```fun getCategoryContent(category: String, staffId: String,
                          position: String, currentPage: Int): Flow<PagingData<ItemsCategory>> = Pager(
        config = PagingConfig(pageSize = 10, initialLoadSize = 10, enablePlaceholders = true),
        pagingSourceFactory = {
            ResultPagingSource { _, _ ->
                getCategoryContentList(category, staffId, position, currentPage).map { it.listOfItemsCategory }
            }
        }
    ).flow
    private suspend fun getCategoryContentList(category: String, staffId: String,
                                       position: String, currentPage: Int): ResultWrapper<ContentCategoryResponse>{
        return try {
            val assetPageResponse = client.request {
                url("categorySpecific")
                setBody(ContentCategoryRequest(category, staffId, position, currentPage))
            }
            if (assetPageResponse.status.isSuccess()) {
                ResultWrapper.Success(
                    assetPageResponse.body<ContentCategoryResponse>(),
                    assetPageResponse.status.value
                )
            } else {
                ResultWrapper.Failure(
                    assetPageResponse.status.value,
                    assetPageResponse.body<APIErrorResponse>()
                )
            }
        } catch (e: Exception) {
            ResultWrapper.NetworkError(e)
        }
    }```

why this happen on folder shared?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant