If I make changes in my Android Library project I have to manually refresh, and sometimes clean all projects that use the Library. Is this normal? Is there a way around this?
AAR files can contain Android resources and a manifest file, which allows you to bundle in shared resources like layouts and drawables in addition to Java classes and methods. AAR files can contain C/C++ libraries for use by the app module's C/C++ code.
Click on Project files. Copy the jar file to the libs folder. Here, you can see our added jar file under the libs folder. Right-click on the jar file and select Add As Library.
I found a workaround for this issue. The basic idea is to use custom ant builder, because it has ability to refresh any specific resource or whole workspace on clean, manual build or auto-build.
So here are the steps:
1) Create a simple ant file with one empty stub target:
<?xml version="1.0" encoding="UTF-8"?>
<project name="android" >
<target name="refresh" />
</project>
2) Name it "lib-refresher.xml" and place it into folder where application's .project file is located.
3) Now go to eclipse, find the project that uses android library (not library project itself).
4) For this project go to: Project -> Properties -> Builder
5) Create new builder, select Ant task, select specified "lib-refresher.xml", select build base folder.
6) important - Refresh tab of ant builder task select "Specific resources" and select you library dependent project.
7) important - On Target tabs select "refresh" target for build variants: Clean, Manual Build, Auto Build.
8) important - Save changes, move your new custom ant builder to the top of builders stack.
Now the whole project is going to refresh just before building and lunching application. This will include all changes made to library project into application project. Which is what was needed.
(This can be done the other way around: library project may refresh whole workspace whenever autobuild is launched. This may be a bit overkill, but may solve some harder cases).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With