apollo-kotlin: java.io.IOException: Unable to delete file

Version: 1.0.0-alpha5

OS: Windows 10

Everytime I try to compile my app, I get this error (see image) due to :app:installApolloCodegen trying to delete package.json.

image

How do I prevent this from happening? It happens constantly. Current work-around is to manually delete it in file explorer. Then try to rerun compilation.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

A better workaround that I have found is to use the global version of apollo-codegen. You can simply install it with:

$ npm install -g apollo-codegen@0.19.1

as it says in the docs and then create a gradle.properties file in your home folder usually C:\Users\<USERNAME>\.gradle\ with the line:

systemProp.apollographql.useGlobalApolloCodegen=true

This way it will not attempt to delete the file constantly, but you can still put the project in version control. Your non-windows team mates will not have the need to install apollo-codegen globally (assuming this problem only exists on Windows)

Having the same issue. Using ‘com.apollographql.apollo:apollo-runtime:1.0.0’, on Windows 10 with Android studio 3.4.1. Have read/write access to file. Clean doesn’t work.