1

Sometimes (especially after restarting the computer I'm working on, or after updating some packages), when I Run the code (via a React Native configuration for Android in IntelliJ), I'm getting errors like:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':linkedin-sdk:packageReleaseResources'.
> Error: Cannot create directory E:\<appname>\android\linkedin-sdk\build\intermediates\
                                    incremental\packageReleaseResources\merged.dir\values

What I'm currently doing is manually deleting several of these build folders (e.g. <appname>\android\build, <appname>\android\app\build, <appname>\node_modules\react-native-fbsdk\android\build etc.) whenever this happens - which works, but is quite tedious and annoying.

I am not too familiar with gradle, so I don't know if relevant gradle clean commands apply here. I don't remember encountering problems like this when working on native projects in Android Studio, so I'm concluding this is something specific to RN-for-android builds.

If this information is useful, I'm using 'com.android.tools.build:gradle:2.3.1', IntelliJ IDEA 2017.1, Win 10. I'm not running IntelliJ as admin.

Would anybody please suggest a way to automate this deletion? I'd also love to know what causes this...

Community
  • 1
  • 1
Dev-iL
  • 23,742
  • 7
  • 57
  • 99

1 Answers1

2

I have created a batch script in the root path of my project, with the following contents:

clean.bat:

rmdir /S /Q %~dp0android\build
rmdir /S /Q %~dp0android\app\build
rmdir /S /Q %~dp0android\linkedin-sdk\build
rmdir /S /Q %~dp0node_modules\react-native-fbsdk\android\build
rmdir /S /Q %~dp0node_modules\react-native-linkedin-sdk\android\build

And added a run configuration that executes it using the Batch Scripts Support plugin (though it can also be done manually).

It doesn't solve the root problem, but at least saves some time when deleting these offending folders.

Dev-iL
  • 23,742
  • 7
  • 57
  • 99