nix-androidenvtests
nix-androidenvtests copied to clipboard
What about gradle?
First, thank you very much for all your great work, it sounds amazing!
I'm quite new to android development and this project interests me. However I have a question : it seems that ant was used in older android versions, but in recent sdk version, android has been droped, and all new projects seems to be impossible to create from command line, and are based on gradle. So ant/android seems to be obsolete now.
So my questions are:
- does it makes sense to continue to do ant based projects?
- do you provide a way to do the compilation for gradle based project, that are created by AndroidStudio?
- if not, is it a choice (why?), or just a lack of time?
- if yes, I've another question less linked with your project, but you may know: are you aware of a way to generate a first template without AndroidStudio (I don't want to download tons of Gb simply to generate a simple template before moving to emacs)
Thanks again for the great job!
Hi,
Thank you for taking interest in the Nix Android build infrastructure. To answer your questions:
- Not so much anymore today, because gradle has now been blessed by Google as the official build tool. However, when it is desired to build older projects or having a Nix-friendly build solution Ant is much more convenient -- gradle's problem is that it also does dependency management that conflicts with Nix's purity principles.
- Not at the moment. There used to be a very basic implementation for gradle projects contributed by somebody else but me, but it does not support any dependency management. Currently, proper gradle build management is not supported.
- It would (of course!) be great to have gradle support. To make this work, somebody needs to develop a gradle2nix generator. I believe there is already an attempt, but that implementation is not even close to a working version. Creating a generator is hard -- I already maintain two of them: node2nix and composer2nix. I can, of course, also start working on a gradle2nix tool, but I simply lack sufficient resources (mostly time) to do this at the moment. Most of my Nix-related work is already done in my spare time and on a volunteer basis.
- The old Android tools package (with the old-fashioned
androidcommand-line) tool allows you to create an Ant-based project from the command-line. I don't know if there is an equivalent solution for gradle-based projects.
Ok thank you very much for this detailed answer, and the time you invest in nix! Just one more question about ant: is there anything you can do in gradle that you could not do with ant? (or rephrased: can I just stay on ant and forget about gradle)
@tobiasBora Did you mean to ask 'is there anything gradle can do that ant+nix can't?'
This is analogous to cabal+nix and stack, or cargo and "insert-future-function"+nix ; cargo and stack try to do things which should be done by a tool like nix. Cargo has really slowed down the evolution of rust+nix. Looks like gradle is doing the same for android. It isn't easy to be a pioneer.