Apollo-android: ResponseWriter.ListWriter() interface implementation error in generated class

Created on 3 Nov 2018  路  10Comments  路  Source: apollographql/apollo-android

While I build my project, Apollo android generate this piece of code

 public ResponseFieldMarshaller marshaller() {
      return new ResponseFieldMarshaller() {
        @Override
        public void marshal(ResponseWriter writer) {
          writer.writeString($responseFields[0], __typename);
          writer.writeList($responseFields[1], liveStreams, new ResponseWriter.ListWriter() {

            @Override
            public void write(List items, ResponseWriter.ListItemWriter listItemWriter) {
              for (Object item : items) {
                listItemWriter.writeObject(((LiveStream) item).marshaller());
              }
            }
          });
        }
      };
    }

when i search in java code found there is no interface that match this, found only one inteface there

interface ListWriter {
    void write(@Nullable Object value, @Nonnull ListItemWriter listItemWriter);
  }

Error I am facing:
error: is not abstract and does not override abstract method write(Object,ListItemWriter) in ListWriter

error: method does not override or implement a method from a supertype

Code was working fine on 1st November but not working now !

Most helpful comment

I would like to bump up this too. I found the commit which broke this https://github.com/apollographql/apollo-android/commit/3a7a6606affb258800d85767268bf92cae9a79bc. It seems that the code generator has not been properly updated?

I must say that my code uses 1.0.1-SNAPSHOT because of an issue in the subscription timeouts which is still not in the main release.

All 10 comments

I would like to bump up this too. I found the commit which broke this https://github.com/apollographql/apollo-android/commit/3a7a6606affb258800d85767268bf92cae9a79bc. It seems that the code generator has not been properly updated?

I must say that my code uses 1.0.1-SNAPSHOT because of an issue in the subscription timeouts which is still not in the main release.

for a quick solution: back to the previous version, that works fine.

@trumpets @milon87 is this issue still valid?

Could you pls clean project, maybe you have cached versions of previous models. And make sure you are using the same version of apollo-api 1.0.1-SNAPSHOT

I have tried cleaning project. It's about your last commit.

I double checked the snapshot version https://oss.sonatype.org/content/repositories/snapshots/com/apollographql/apollo/apollo-api/1.0.1-SNAPSHOT/ and it seems that everything legit:

  interface ListWriter<T> {
    void write(@Nullable List<T> items, @NotNull ListItemWriter listItemWriter);
  }

Plus we have a test https://github.com/apollographql/apollo-android/blob/master/apollo-compiler/src/test/graphql/com/example/hero_details/HeroDetails.java#L342
that passes ok

https://github.com/apollographql/apollo-android/blob/master/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseWriter.java#L25

The only thing I can think of is the cache for snapshots artifacts. Will kick off a new release, hope that will help

Yeah I saw the same issue on my local machine, invalidating and re-downloading gradle dependencies helped. It seems that OSS screwed up or gradle with snapshot version

I think we can close this issue, pls try the latest release

I have tried all the ways but still I get the same error:
error: is not abstract and does not override abstract method write(List,ListItemWriter) in ListWriter
writer.writeList($responseFields[1], items, new ResponseWriter.ListWriter() {

My Project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.6.3'
    classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:2.8.3'
    //classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.1'
    classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.2.1'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
google()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }

}

}

task clean(type: Delete) {
delete rootProject.buildDir
}

and my app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.amazonaws.appsync'
apply plugin: 'com.apollographql.android'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.example.aws_api_test"
    minSdkVersion 26
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.amazonaws:aws-android-sdk-appsync:2.8.3'
//implementation 'com.apollographql.apollo:apollo-runtime:1.0.1'
implementation 'com.apollographql.apollo:apollo-runtime:1.2.1'
//implementation("com.apollographql.apollo:apollo-normalized-cache-sqlite:2.0.0")
implementation "com.apollographql.apollo:apollo-android-support:1.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'
// Mobile Client for initializing the SDK
implementation('com.amazonaws:aws-android-sdk-mobile-client:2.13.2@aar') { transitive = true }

// Cognito UserPools for SignIn
implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.13.7@aar') { transitive = true }

// Sign in UI Library
implementation('com.amazonaws:aws-android-sdk-auth-ui:2.13.7@aar') { transitive = true }
implementation("com.squareup.okio:okio:2.5.0")
implementation("org.jetbrains:annotations:13.0")
testImplementation("org.jetbrains:annotations:13.0")

}
Can you please help me to resolve this issue...

@sudeep-patchava your project uses both com.amazonaws:aws-android-sdk-appsync-gradle-plugin and com.apollographql.apollo:apollo-gradle-plugin.
Please open a new bug if you can reproduce with just com.apollographql.apollo:apollo-gradle-plugin and a the latest version (2.0.0 as I'm speaking)

Was this page helpful?
0 / 5 - 0 ratings