【问题标题】:GraphQL - Nullable is not a repeatable annotation typeGraphQL - Nullable 不是可重复的注释类型
【发布时间】:2020-08-11 23:18:43
【问题描述】:

我在项目中使用 AWS:

implementation('com.amazonaws:aws-android-sdk-appsync:3.0.1')
implementation('org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0')
implementation('org.eclipse.paho:org.eclipse.paho.android.service:1.1.1')
implementation("com.amazonaws:aws-android-sdk-s3:2.16.11")
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.16.3@aar') {
    transitive = true
}
implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.16.3@aar') {
    transitive = true
}

并面临由于生成代码问题而无法构建应用程序的问题:

package com.amazonaws.amplify.generated.graphql;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
....

public static class ListUsers {
final @Nullable @Nullable List<Item> items;

public ListUsers(@Nonnull String __typename, @Nullable @Nullable List<Item> items,
    @Nullable String nextToken) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.items = items;
  this.nextToken = nextToken;
}

public @Nonnull String __typename() {
  return this.__typename;
}

public @Nullable @Nullable List<Item> items() {
  return this.items;
}

由于error: Nullable is not a repeatable annotation type,构建失败

可能是什么原因?有没有办法解决这个问题?

【问题讨论】:

    标签: amazon-web-services android-studio graphql code-generation aws-amplify


    【解决方案1】:

    我昨天遇到了完全相同的问题。 AWS Android 团队将我的问题请求移至 AppSync 团队。

    您可以在这里跟踪进度:https://github.com/awslabs/aws-mobile-appsync-sdk-android/issues/273#

    【讨论】:

    • 嗨@micstepper,你的androidx.navigation 版本是什么?为我发现它在2.3.0-alpha05 下失败,但在2.3.0-alpha04' 下工作正常
    【解决方案2】:

    我遇到了同样的问题,我的项目没有使用导航库,解决方法是将 Hilt 恢复到版本 2.35.1,将 Gradle 恢复到版本 4.2.2

    dependencies {
        ...
        classpath "com.android.tools.build:gradle:4.2.2"
        classpath "com.google.dagger:hilt-android-gradle-plugin:2.35.1"
    }
    
    dependencies {
        // Hilt
        implementation "com.google.dagger:hilt-android:2.35.1"
        kapt "com.google.dagger:hilt-android-compiler:2.35.1"
    }
    

    【讨论】:

      猜你喜欢
      • 2020-01-18
      • 1970-01-01
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 2016-09-22
      • 2022-09-29
      • 1970-01-01
      相关资源
      最近更新 更多