Apollo-android: java.io.IOException: Unable to delete file

Created on 24 Apr 2019  路  16Comments  路  Source: apollographql/apollo-android

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.

Most helpful comment

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 [email protected]

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)

All 16 comments

Is it windows OS?

Hello! I have the same issue on Windows

@sav007 Sorry for late response. Yes its Windows specific.
Any clue?

It might be some issues with the access right, we saw this in the past for Windows OS

I do not think this is a permissions problem. I tried to grant full access to all users and it didn't help while rebuild did the thing

I agree, grant permission isn't a sufficient solution. I gave the folder and subfolders full access and still this issue occurs.

I have the same issue. If i run Build -> Rebuild Project it seems to properly clean it, but this is not a nice work around.

OS: Windows 10
Version: 1.0.0-alpha5
Android Studio: 3.4

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 [email protected]

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)

We might get a fix of this issue via https://github.com/apollographql/apollo-android/pull/1338

I think we can close this, I don't see the issue occurring after upgrading to 1.0.0.

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.

@mesargent did you find a fix for this? I have the same problem!

@mesargent did you find a fix for this? I have the same problem!

I switched to: 'com.apollographql.apollo:apollo-runtime:1.0.2-SNAPSHOT' instead of 1.0.0; seemed to fix the problem

@mesargent Umm.. I'm using this API for the first time and I'm referring the docs at https://aws-amplify.github.io/docs/android/start?ref=amplify-android-btn (the Amplify framework docs). There is no specific dependency included in the docs. Is there somewhere else I have to change the version? Or can I add is as a new dependency?

Just add implement com.apollographql.apollo:apollo-runtime:1.0.2-SNAPSHOT to your dependencies, remove the earlier one.

I think this version is not an official release yet

@mesargent thanks man..It works for me!

Was this page helpful?
0 / 5 - 0 ratings