How to fix 'main GraphQL source' error at code generation using Apollo?

I tried what Sneha suggested, that's working fine for me.

If you don't want to downgrade Android Gradle plugin and Gradle version you can change

classpath 'com.apollographql.apollo:gradle-plugin:0.4.1'

to

classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.0'

in your project level build.gradle file.

Also please update apollo-runtime and apollo android support library to latest version in your build.gradle file of app module.

implementation 'com.apollographql.apollo:apollo-runtime:1.0.0'
implementation "com.apollographql.apollo:apollo-android-support:1.0.0"

Hopefully this will resolve your issue, let me know if you've any issue further.


In Project structure(File -> Project Structure -> Project) change your Gradle plugin version to 3.3.2 and Gradle version to 4.10.1.

if it still didn't work, change the Gradle versions to the older.

Hope it will works. Worked the same for me.