bugsnag / bugsnag-android-gradle-plugin

Gradle plugin for BugSnag which uploads ProGuard, DexGuard and NDK mapping files, and sends build notifications
https://docs.bugsnag.com/build-integrations/gradle/
MIT License
70 stars 38 forks source link

New error in bugsnag gradle plugin 5.8.0 assembling release #437

Closed davidhartley closed 3 years ago

davidhartley commented 3 years ago

When assembling release, gradlew fails with the following. Error is super unclear until you add --stacktrace

Falling back to 5.7.8 fixed the issue though we had 5+ originally so it took a bit of detective work to figure out what changed.

* Exception is:
java.lang.NoSuchFieldError: DEFAULT_CONSTRUCTOR_MARKER
        at com.bugsnag.android.gradle.AndroidManifestInfoJsonAdapter.fromJson(AndroidManifestInfoJsonAdapter.kt:82)
        at com.bugsnag.android.gradle.AndroidManifestInfoJsonAdapter.fromJson(AndroidManifestInfoJsonAdapter.kt:19)
        at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
        at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:36)
        at com.bugsnag.android.gradle.AndroidManifestInfo$Companion.read(AndroidManifestInfo.kt:60)
        at com.bugsnag.android.gradle.BugsnagPlugin$registerBugsnagTasksForVariant$1$manifestInfoProvider$2.transform(BugsnagPlugin.kt:210)
        at com.bugsnag.android.gradle.BugsnagPlugin$registerBugsnagTasksForVariant$1$manifestInfoProvider$2.transform(BugsnagPlugin.kt:68)
        at org.gradle.api.internal.provider.TransformBackedProvider.mapValue(TransformBackedProvider.java:73)
        at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:65)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
        at org.gradle.api.internal.provider.MappingProvider.calculateOwnValue(MappingProvider.java:55)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:151)
        at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:133)
        at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:25)
        at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:236)
        at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:230)
        at org.gradle.api.internal.provider.AbstractProperty.calculatePresence(AbstractProperty.java:56)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.isPresent(AbstractMinimalProvider.java:74)
        at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$BeanPropertyValue.call(AbstractNestedRuntimeBeanNode.java:137)
        at org.gradle.api.internal.tasks.properties.AbstractValidatingProperty.validate(AbstractValidatingProperty.java:39)
        at org.gradle.api.internal.tasks.properties.DefaultTaskProperties.validate(DefaultTaskProperties.java:194)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.validate(ExecuteActionsTaskExecuter.java:492)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:187)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        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.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        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:372)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
        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)
xljones commented 3 years ago

šŸ‘‹ hi @davidhartley, can you please share with us what your environment looks like so we can look into replicating this:

xljones commented 3 years ago

This looks to be an issue with the buildScript classpath using an older version of Moshi. It will affect anyone using bugsnag-android-gradle-plugin v5.8.0 or v7.1.0, and a plugin that uses Moshi versions <= 1.9.0.

A workaround is to force the Moshi version used to a more recent version. This should preferably be done by updating the other plugin using the outdated version of Moshi - performing a gradle build scan and looking at the build dependencies should allow the offending plugin to be identified.

Alternatively, making the following modifications to the project build.gradle would resolve the issue:

dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"
        classpath "com.bugsnag:bugsnag-android-gradle-plugin:5.8.0"
        classpath "com.squareup.moshi:moshi:1.9.3"
    }
    configurations.classpath {
        resolutionStrategy {
            force "com.squareup.moshi:moshi:1.9.3"
        }
    }

We'll take a look into a resolution that will allow this to play nicely in future.

yousif-bugsnag commented 3 years ago

Hey @davidhartley - this is now fixed in v5.8.1