I am working on an Android project where I need to replace the contents of the java class for only one type of assembly (i.e. type of assembly) before gradle. I do not want to remove or replace the original contents for different types of assemblies.
As an example, I have two different types of assembly:
- Debug
- Release
- Modify the contents of Test.java
What I have tried so far is to delete the contents of Test.java and rewrite some other content with groovy (gradle). But once the assemblies are completed, Test.java is already overridden by the new content and cannot be returned back to its original state. Is there any other way to achieve a mechanism in which I can store different content for different types of assemblies in a single file?
Thanks in advance.
Ahmed source
share