awslabs / aws-mobile-appsync-sdk-android

Android SDK for AWS AppSync.
https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
Apache License 2.0
105 stars 58 forks source link

Gradle 7 build error #360

Closed baksansk closed 1 year ago

baksansk commented 3 years ago

When you update to Gradle 7.1.1 and Android Gradle plugin 7.0.0 you get the following build error:

Some problems were found with the configuration of task ':myTask:generateDebugApolloIR' (type 'ApolloIRGenTask').
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'extension' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'extension'.
      2. Remove the annotations on 'extension'.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'sourceSets' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'sourceSets'.
      2. Remove the annotations on 'sourceSets'.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'variant' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'variant'.
      2. Remove the annotations on 'variant'.

    Please refer to https://docs.gradle.org/7.1.1/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.build(WorkValidationException.java:109)
        at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.get(WorkValidationException.java:91)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:98)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:51)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:72)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:46)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:284)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
        at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
        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:51)
        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:79)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
        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)
ksgangadharan commented 3 years ago

Facing the issue, using the 3.2.0 version of this library. When is the above committed fix expected to be released? Currently we have rollbacked AGP version to 4.2.2 for this to work. Thanks.

thegamer123 commented 2 years ago

@baksansk can you please try to merge the branches and push a stable a version , we really need that gradle 7 fix

SteveHigham commented 2 years ago

I cannot get appsync working with my amplify app due to this problem. I've tried AGP 4.2.2, gradle 6.7.1 and gone back to appsync 2.11.0. I can build OK but it will not run. I'm getting a gradle build exception caused by a FileNotFoundException for "/Users/steve/.gradle/daemon/6.7.1/amplify/backend/api" which is just wrong... I've got this working fine on an iOS version of my app. Just the Android version which seems to be broken!

baksansk commented 2 years ago

The PR was merged and waiting for the next release.

baksansk commented 2 years ago

After merging the previous PR to fix a compile issue with Gradle 7, I encountered a different error regarding private NullableValueType nullableValueType in ApolloGenTask. I don't have the specific error here but it is about a missing annotation on a private property. It's missing Input/Output annotation. Adding @Internal would fix this.

eeatonaws commented 2 years ago

These PRs have been released as part of version 3.2.1.

ksgangadharan commented 2 years ago

The issue is persisting in 3.2.1 as well. I just tested it. Please reopen. The build error is:

Some problems were found with the configuration of task ':app:generateDebugApolloIR' (type 'ApolloIRGenTask').
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'extension' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'extension'.
      2. Remove the annotations on 'extension'.
baksansk commented 2 years ago

extension does have a getter method: https://github.com/awslabs/aws-mobile-appsync-sdk-android/blob/b59540b12db962ede72e6ff5b8c861707d6a53f1/aws-android-sdk-appsync-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/ApolloIRGenTask.java#L273

need to reproduce this with a minimal project to expose all related errors to Gradle 7. When I applied the fix (adding @Internal annotation to extension), it seems to work with Gradle 7.3.

somq commented 2 years ago

Seems to be working for me with gradle plugin 7.0.3 and gradle 7.0.2
Thanks @baksansk

ksgangadharan commented 2 years ago

I am not sure whether I am missing something, I am pointing to 3.2.1 version, AGP is set to 7.0.2 and Gradle is set to 7.3 (I tried 7.0.2 also). To be sure, I also invalidated my caches and restarted, and I also did a build clean. Its the same error. Also note its just not extensions, my previous error message was incomplete:

* What went wrong:
Some problems were found with the configuration of task ':app:generateDebugApolloIR' (type 'ApolloIRGenTask').
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'extension' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'extension'.
      2. Remove the annotations on 'extension'.

    Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'sourceSets' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'sourceSets'.
      2. Remove the annotations on 'sourceSets'.

    Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
  - In plugin 'com.amazonaws.appsync' type 'com.apollographql.apollo.gradle.ApolloIRGenTask' field 'variant' without corresponding getter has been annotated with @Internal.

    Reason: Annotations on fields are only used if there's a corresponding getter for the field.

    Possible solutions:
      1. Add a getter for field 'variant'.
      2. Remove the annotations on 'variant'.

    Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#ignored_annotations_on_field for more details about this problem.
ksgangadharan commented 2 years ago

I tried the latest 3.3.0 version of the library and the issue still persists. Please can this be looked into? We are having to hold off on Gradle plugin updates just because of this issue

poojamat commented 2 years ago

at app level add in build.gradle this: classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.3.0' Fixed with this PR: https://github.com/awslabs/aws-mobile-appsync-sdk-android/pull/361

melchi45 commented 2 years ago

I think, It is same issue on my project. So I was add @Internal annotation from original source code. Gradle 7 has annotation issue from internal variance without @Internal annotation.

So, I was change the original code from https://github.com/noamt/rest-gradle-plugin to https://github.com/melchi/rest-gradle-plugin. adding the @Internal annotation in original code like for me when you have same issues.

poojamat commented 2 years ago

@melchi45 which version of sdk are you using?