Closed nodejsjs closed 3 years ago
Well that's weird. It's definitely in the jar from Maven central:
$ unzip -l licensee-gradle-plugin-1.0.2.jar | \grep LicensesKt
1131 06-09-2021 15:23 app/cash/licensee/LicensesKt$detailsComparator$3.class
6381 06-09-2021 15:23 app/cash/licensee/LicensesKt.class
1131 06-09-2021 15:23 app/cash/licensee/LicensesKt$detailsComparator$1.class
1140 06-09-2021 15:23 app/cash/licensee/LicensesKt$detailsComparator$2.class
There's no further cause in the stacktrace? Usually something would be calling Class.loadClass
that would indicate where the problem occurred.
We are also running into the same issue when trying it out on a project. It manifests as 2 separate errors depending on the state of the gradle daemon. When running on a cold daemon, we get a slightly different NoSuchMethodException
(stack below). The second time we run the task we get the same NoClassDefFoundError
as the original issue which I guess makes sense if the JVM failed during class init the first time around. 🤷
Running: Gradle 6.5 Kotlin Plugin 1.5.10
STEP 3: Normalize license information
Task :app:licenseeProductionDebug in app Finished
:app:licenseeProductionDebug (Thread[Execution worker for ':',5,main]) completed. Took 1.191 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:licenseeProductionDebug'.
> kotlin.jvm.internal.PropertyReference1Impl.<init>(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:licenseeProductionDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:207)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:205)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.NoSuchMethodError: kotlin.jvm.internal.PropertyReference1Impl.<init>(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
at app.cash.licensee.LicensesKt$detailsComparator$1.<init>(licenses.kt)
at app.cash.licensee.LicensesKt$detailsComparator$1.<clinit>(licenses.kt)
at app.cash.licensee.LicensesKt.<clinit>(licenses.kt:45)
at app.cash.licensee.LicenseeTask.execute(task.kt:134)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
Works fine on a smaller project or a hello world project. Not sure if that helps in any way
Thanks that trace is more informative.
I believe this is the "classic" problem of Gradle putting Kotlin on the buildscript classpath and then not tracking the latest versions fast enough. Basically we depend on Kotlin 1.5 and Gradle ships with very old versions such as Kotlin 1.3 and 1.2. I wonder if we can set our compatibility to an older Kotlin version and mitigate this...
I'll have to find time to try. Maybe tomorrow.
Got the same error on Gradle 6.7.1, but works fine on 6.8 (which embeds Kotlin 1.4.20)
Been sick. Haven't lost track of this, though.
Tried version 1.1.0
in Android Studio 4.1.3
, with Kotlin 1.3.72
, but I still get Could not initialize class app.cash.licensee.LicensesKt
Hmm not sure what else to do. Can you update to newer versions AGP and Gradle?
project/build.gradle
:project/app/build.gradle
:Running the task
./gradlew :app:licensee
fails the build with the following stacktrace:The project has about 70 modules.