How to trigger AndroidStudio/IntelliJ to re-read a .jar file?
I am currently working with two Android projects: one is a library that produces a .jar file, the other an application that makes uses of the library by importing/referencing that .jar-file.
When I make a change to the library then AndroidStudio will display me syntax errors and warnings if any of the library API methods was changed and the name and/or any parameter(s) already matches the new version. The build will then succeed, because the name and/or parameter(s) are actually correct (with respect to the new .jar) but the Editor and Syntax-check still refer to the old .jar version which is obviously cached and not reloaded. Same issue when debugging and stepping through library code - then the decompiled classes don't match the new jar's content and the display is often wrong.
The only way to trigger such a cache-refresh is to trigger "File" -> "Invalidate Caches..." which is actually a "invalidate caches and restart" which - due to the restart of the entire IDE, which then first re-imports everything - always takes quite long and is really getting tedious.
Is there really no other mean to just reload a specific .jar into the cache? Why are these .jars not monitored and automatically reloaded when their modification-date changes, anyway?
Please sign in to leave a comment.
The IDE refreshes files that changed outside it when its window regains focus. IJPL-2188 tracks cases where it misses such a change until a manual refresh.
IDEA-358919 describes a replaced jar that the IDE did not pick up. Please try the step suggested there: right-click the project in the Project tool window and choose Reload from Disk. The reporter found that File | Reload All from Disk did not help, so I would like to know whether this step works for you.
Could you also tell me: