Can't access Apollo classes in Kotlin Multiplatform project

399 views Asked by At

I've just created a new KMP project from Android studio, added Apollo MP as defined here: https://www.apollographql.com/docs/android/essentials/get-started-multiplatform/

plugins {
  // ...
  id("com.apollographql.apollo").version("2.5.3")   
}

sourceSets {
  // ...
  commonMain {
    dependencies {
      implementation("com.apollographql.apollo:apollo-runtime-kotlin:2.5.3")
    }
  }   
}

The classes are generated under 'commonMain/build/generated/source/apollo' but i can't access them nor any Apollo classes (e.g. ApolloClient) from the commonMain code.

Also i've noticed that Apollo does not appear under the project External Libraries as well.

From the same link above:

Add your schema.json and other .graphql files under src/commonMain/graphql. Build your module and generated code will be available under commonMain sourceSet. That means you can use them both in commonMain or platform specific Kotlin code. Once the Kotlin plugin builds the iOS Framework, generated code can even be called from Swift code.

What am i missing? Thanks

0

There are 0 answers