How to make Android Studio and Eclipse coexist (gradle dependencies)

36 Views Asked by At

I need to use Eclipse and Android Studio on the same computer, simultaneously, for different projects.

The Eclipse project is Enterprise Java deploying on Payara (Glassfish) via the WTP toolkit and Deployment Assembly. When setting up the project I build with gradle build and gradle eclipse, which pulls all the required dependencies and configures the Deployment Assembly in Eclipse. However, I believe that any incremental code changes thereafter are compiled by Eclipse without using gradle (e.g., when I save a file).

Android Studio always compiles with gradle.

The issue that I have is that every couple of weeks, when I compile my Android Studio project, gradle decides to delete all my Eclipse project dependencies. My guess is that it thinks that they are not in use any more, since Eclipse compiles outside gradle. This results in my Eclipse workspace pointing to libs that are no longer there.

If I manually run gradle build in my Eclipse project dir, my dependencies are restored and Eclipse no longer complains. But something seems to be cached wrong somewhere so after this my web app will no longer deploy on the server. At that point my workspace is effectively corrupted and to this day I haven't found any workaround, other than to delete it and start all over again. Which is *A LOT* of work to reconfigure.

Any help will be greatly appreciated.

0

There are 0 best solutions below