mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.62k stars 419 forks source link

Error - Please provide the required library data via the available APIs. #910

Closed Abhimanyu14 closed 1 year ago

Abhimanyu14 commented 1 year ago

About this issue

I am trying to use this library.

I am getting this error

Please provide the required library data via the available APIs.

Complete Error

java.lang.IllegalStateException: Please provide the required library data via the available APIs. Depending on the platform this can be done for example via LibsBuilder().withJson(). For Android there exists an LibsBuilder.withContext(), automatically loading the aboutlibraries.json file from the raw resources folder. When using compose or other parent modules, please check their corresponding APIs. at com.mikepenz.aboutlibraries.Libs$Builder.build(Libs.kt:37) at com.mikepenz.aboutlibraries.ui.compose.LibrariesKt$LibrariesContainer$1.invoke(Libraries.kt:47) at com.mikepenz.aboutlibraries.ui.compose.LibrariesKt$LibrariesContainer$1.invoke(Libraries.kt:46) at com.mikepenz.aboutlibraries.ui.compose.LibrariesKt$LibrariesContainer$libraries$1$1.invokeSuspend(Libraries.kt:64) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@2315a00, androidx.compose.runtime.BroadcastFrameClock@46f8239, StandaloneCoroutine{Cancelling}@e3e007e, AndroidUiDispatcher@400c9df]

Code used (Copied from the library app module)

LibrariesContainer(
            Modifier
                .fillMaxSize()
                .padding(),
            contentPadding = WindowInsets.navigationBars.asPaddingValues(),
            showAuthor = true,
            showVersion = true,
            showLicenseBadges = true,
            header = {
                stickyHeader {
                    Column(
                        modifier = Modifier
                            .fillMaxWidth()
                            .padding(vertical = 25.dp),
                        horizontalAlignment = Alignment.CenterHorizontally,
                    ) {
                        Text("ExampleHeader")
                    }
                }
            }
        )

Details

Checklist

Abhimanyu14 commented 1 year ago

Duplicate of https://github.com/mikepenz/AboutLibraries/issues/865 https://github.com/mikepenz/AboutLibraries/issues/858

I have opened a new issue as I don't find the resolution there

mikepenz commented 1 year ago

On which platform are you trying to use it?

Android or on a different platform?

Is the gradle plugin correctly applied to the module?

Do you see the generated data by the plugin in: build/generated/aboutLibraries?

Abhimanyu14 commented 1 year ago

Platform : Android

libs.versions.toml

[versions]
about-libraries = "10.8.3"

[libraries]
#about libraries
about-libraries-core = { group = "com.mikepenz", name = "aboutlibraries-core", version.ref = "about-libraries" }
about-libraries-compose = { group = "com.mikepenz", name = "aboutlibraries-compose", version.ref = "about-libraries" }

[plugins]
about-libraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "oss-licenses" }

Project build.gradle

plugins {
    alias libs.plugins.about.libraries
}

Feature build.gradle

dependencies {
    // About libraries
    implementation libs.about.libraries.core
    implementation libs.about.libraries.compose
}

Project repo link - https://github.com/Abhimanyu14/finance-manager

Abhimanyu14 commented 1 year ago

I don't find a build/generated/aboutLibraries package.

Will try adding the dependency in app module as well to see if that is required.

mikepenz commented 1 year ago

Looks your app module does not apply the plugin: https://github.com/mikepenz/AboutLibraries/blob/develop/app/build.gradle#L5 ?

The plugin needs to be applied so it can hook up with the android build steps.

If you would prefer it not running automatically you can run it manually via cli and add the output to your SCM. (Make sure to pass the file to the LibraryContainer in that case. That's for example done in the desktop app sample: https://github.com/mikepenz/AboutLibraries/blob/develop/app-desktop/README.md

Abhimanyu14 commented 1 year ago

Thank You. It works with this change.