Giter Site home page Giter Site logo

Comments (16)

mikepenz avatar mikepenz commented on May 30, 2024

Can you please provide more details? Which error do you get?

from aboutlibraries.

sucicf1 avatar sucicf1 commented on May 30, 2024

when I don't use the workaround sometimes I can sync and sometimes not the gradle files. But even if I can sync gradle files I get during building my apk the following error (similar error when I can't sync gradle files):

Duplicate class com.mikepenz.aboutlibraries.Libs found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.Libs$Builder found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.Libs$Builder$build$$inlined$sortedBy$1 found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.Developer found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.Funding found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.Library found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.License found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.Organization found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.entity.Scm found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)
Duplicate class com.mikepenz.aboutlibraries.util.Result found in modules jetified-aboutlibraries-core-jvm-10.8.3 (com.mikepenz:aboutlibraries-core-jvm:10.8.3) and jetified-aboutlibraries-core-release-runtime (com.mikepenz:aboutlibraries-core-android:10.8.3)

when I use the workaround I can sync gradle and build apk but running the app when it needs to display the package list it displays empty and in logcat I found the following:

Unable to read the library information
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.viewmodel.LibsViewModel$listItems$1$1.invokeSuspend(LibsViewModel.kt:85)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
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)

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

This looks to be like 2 different reports.

For the first: It seems the jettifier is somehow duplicating classes. Do you really still need the jettifier in your app?

For the second. Please make sure the plugin is properly applied, and the generation of the meta data works. (the build folder should contain the json output, unless you have it configured to manually generate the data?)

from aboutlibraries.

sucicf1 avatar sucicf1 commented on May 30, 2024

Currently I have only one module and use the module wide solution. I can't remove jetifier without some medium work. On the other hand in the second case I see in logcat:
Unable to retrieve library information given the raw resource identifier.
Please make sure either the gradle plugin is properly set up, or the file is manually provided.
I am setting up the gradle plugin like following:

plugins {
    id 'com.mikepenz.aboutlibraries.plugin' version "10.8.3"
} 

Is that OK?

from aboutlibraries.

sucicf1 avatar sucicf1 commented on May 30, 2024

I removed the jetifier and still get the duplicate class error.

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

Could it be possibly similar problem like: #881 (comment)

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

I have the same issue on def latestAboutLibsRelease = '10.9.2.

    //implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
    //implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"

produces:
java.lang.ClassNotFoundException: Didn't find class "com.mikepenz.aboutlibraries.util.AndroidExtensionsKt"

Some more stack trace

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mikepenz/aboutlibraries/util/AndroidExtensionsKt;
at com.mikepenz.aboutlibraries.ui.LibsSupportFragment$viewModel$2.invoke(LibsSupportFragment.kt:54)
at com.mikepenz.aboutlibraries.ui.LibsSupportFragment$viewModel$2.invoke(LibsSupportFragment.kt:47)
at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:47)
at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:35)
at com.mikepenz.aboutlibraries.ui.LibsSupportFragment.getViewModel(LibsSupportFragment.kt:47)
at com.mikepenz.aboutlibraries.ui.LibsSupportFragment.access$getViewModel(LibsSupportFragment.kt:42)
at com.mikepenz.aboutlibraries.ui.LibsSupportFragment$onCreateView$2$1$1.invokeSuspend(LibsSupportFragment.kt:95)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)

Using this workaround

implementation("com.mikepenz:aboutlibraries-core-android:${latestAboutLibsRelease}")
    implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}") {
        exclude group: 'com.mikepenz', module: 'aboutlibraries-core'
    }

works, but the list of libraries is empty.

My build.gradle

buildscript {
....
}

plugins {
    id 'com.mikepenz.aboutlibraries.plugin' version "10.9.2"
}

App level

plugins {
    id 'com.mikepenz.aboutlibraries.plugin'
}

Code to call the library:

            new LibsBuilder()
                    .withAboutIconShown(true)
                    .withAboutVersionShown(true)
                    .withAboutDescription(getString(R.string.about_tv_main))
                    .withAboutSpecial1(getString(R.string.privacy_policy))
                    .withListener(...)
                    .start(this);

build/generated/aboutLibraries is empty

Unable to retrieve library information given the `raw` resource identifier. 
Please make sure either the gradle plugin is properly set up, or the file is manually provided. 
Unable to read the library information
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.viewmodel.LibsViewModel$listItems$1$1.invokeSuspend(LibsViewModel.kt:85)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
	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)

Using Pixel6 API 33 for testing, java project.

Using library version 8.9.4 shows at least two items in the list: The AboutLibrary lib and FastAdapter (I guess used by AboutLibraries)

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

is the build/generated/aboutlibraries staying empty even when doing a clean build?

if you manually run the gradle task, would it have dependencies resolved?

./gradlew findLibraries

What gradle version are you using?

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

Using Gradle 8.4.

./gradlew findLibraries

let to

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

Changing

#org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"

to

org.gradle.jvmargs=-Xmx1024m

in gradle.properties

solved this issue.

The library still isn't working after clean rebuild. (No build/generated/aboutlibraries folder available)

./gradlew findLibraries
Calculating task graph as no configuration cache is available for tasks: findLibraries

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:8.0.2.
     Required by:
         project :
      > No matching variant of com.android.tools.build:gradle:8.0.2 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:
          - Variant 'apiElements' capability com.android.tools.build:gradle:8.0.2 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'javadocElements' capability com.android.tools.build:gradle:8.0.2 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'runtimeElements' capability com.android.tools.build:gradle:8.0.2 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'sourcesElements' capability com.android.tools.build:gradle:8.0.2 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
   > Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.7.1.
     Required by:
         project :
      > No matching variant of androidx.navigation:navigation-safe-args-gradle-plugin:2.7.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:
          - Variant 'apiElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'runtimeElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'sourcesElements' capability androidx.navigation:navigation-safe-args-gradle-plugin:2.7.1 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
   > Could not resolve com.google.gms:google-services:4.4.0.
     Required by:
         project :
      > No matching variant of com.google.gms:google-services:4.4.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:    
          - Variant 'apiElements' capability com.google.gms:google-services:4.4.0 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'javadocElements' capability com.google.gms:google-services:4.4.0 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'runtimeElements' capability com.google.gms:google-services:4.4.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'sourcesElements' capability com.google.gms:google-services:4.4.0 declares a component for use during runtime, and its dependencies declared externally:
              - Incompatible because this component declares documentation and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
Configuration cache entry stored.

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

When I try to build a realease build I also get this:

C:/Users/.../.gradle/caches/transforms-3/3da79f2f13a3f61c7d4287911f5a6908/transformed/aboutlibraries-10.9.2/jars/classes.jar!/META-INF/aboutlibraries.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

Project is written in java. Only external libraries might use kotlin. I do not have anything related to kotlin defined in my build.gradle files

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

Please have a look on this MWE: https://github.com/dhoehl/LibraryTest

It demonstrates the crash if this code is not used:

implementation("com.mikepenz:aboutlibraries-core-android:${latestAboutLibsRelease}")
    implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}") {
        exclude group: 'com.mikepenz', module: 'aboutlibraries-core'
    }

and it also demonstrates the missing json file (and resulting empty library screen. Simply change the build.gradle to reproduce both errors

    //Uncomment this and comment block (2) will let the app crash
    //Block (1)
    //implementation "com.mikepenz:aboutlibraries-core:${latestAboutLibsRelease}"
    //implementation "com.mikepenz:aboutlibraries:${latestAboutLibsRelease}"

    //Uncomment this and comment block (1) so the app will start library screen but without any library present
    //Block (2)
    implementation("com.mikepenz:aboutlibraries-core-android:${latestAboutLibsRelease}")
    implementation("com.mikepenz:aboutlibraries:${latestAboutLibsRelease}") {
        exclude group: 'com.mikepenz', module: 'aboutlibraries-core'
    }

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

Thank you for this. I'll try to come to this as soon as possible

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

I have some new insights:

Using this at top level gradle will reproduce the error (no json file in build folder)

plugins {
    id 'com.mikepenz.aboutlibraries.plugin' version "10.9.2"
}

But using this in top level gradle resp. in module gradle will produce the json file. In my MWE example this solves all issues and creates a full working library screen.

plugins {
    id 'com.mikepenz.aboutlibraries.plugin' version "10.9.2" apply false
}
plugins {
    id 'com.mikepenz.aboutlibraries.plugin'
}

In my production app this helped as well. The screen is not blank anymore and the app does not throw an exception. Nevertheless the json that is produced is empty. The build log gives me the following output for every library:

> Task :app:prepareLibraryDefinitionsDebug
--> Retrieved no components for: androidx.activity:activity:1.8.0
--> Retrieved no components for: androidx.activity:activity-ktx:1.8.0
--> Retrieved no components for: androidx.annotation:annotation-experimental:1.3.0
--> Retrieved no components for: androidx.annotation:annotation-jvm:1.6.0
--> Retrieved no components for: androidx.appcompat:appcompat:1.6.1
--> Retrieved no components for: androidx.appcompat:appcompat-resources:1.6.1
--> Retrieved no components for: androidx.arch.core:core-common:2.2.0
...

I could not figure out the difference between the MWE and my real app. But we are getting closer to a solution, I think.

I deleted .idea, .gradle and build dir still get the same result.

from aboutlibraries.

dhoehl avatar dhoehl commented on May 30, 2024

Add this org.gradle.unsafe.configuration-cache=false to your gradle.properties file. With the above fix and workarounds the library works again finally.

So it was the gradle configuration cache after all

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

Thank you for the update @dhoehl

from aboutlibraries.

mikepenz avatar mikepenz commented on May 30, 2024

Closing as config cache problems are tracked here: #839

from aboutlibraries.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.