Ant versus Eclipse builds for Android: Strengths of Each? - android

I've used Eclipse and vim variously as development environments for Android applications and found both the Eclipse plugin and the command-line SDK tools to be of similar capability.
Since I haven't explored either in its entirety, however, I'd like to ask:
What advantages are there to using Eclipse over the command-line tools and vice-versa?
I could see:
(Eclipse) nice GUI for debugging
(ant/adb/android) more amenable to automation
(hybrid) you can have it all, can't you!?
I'm especially interested in specific features that may be a deal-breaker for one and move a developer in the direction of the other.

Using Eclipse as a development environment for Android doesn't preclude you from also building with Ant to hook into nightly builds or CI tools. You could even configure Eclipse to build using your Ant buildfile if you wanted. If you want some kind of CLI build tool, you might also consider Maven, as it also has plugins to enable building Android apps.

It has been some time (like six months) since I have used eclipse, so maybe it is better now, but I gave up on it because I found it to be very slow and buggy. Maybe it is the integration with ADT, but several times I spent hours hunting down problems that turned out to be fixed if I killed and restarted eclipse (and these problems were not fixed if I did a "clean" within eclipse). After doing that a few times, I felt like throwing the computer against the wall.
"ant clean" is much easier and faster than stopping and restarting eclipse.

Across my personal projects and multiple professional instances of building Android apps, I've always used both types of builds. You'll want to use Ant (or Maven, if you prefer) to set up continuous integration and automated testing. Trying to get that working with Eclipse (which I did a long time ago when the Android SDKs were first coming out) is a nightmare, while Ant/Maven is easily used from any of your favorite CI tools (I've usually used Hudson for this). If there's nothing unusual about your project, it'll be a snap to put together continuous integration, and off you go.
Meanwhile, for just day to day development work, using Eclipse to build your app locally works just fine. But that can easily be left up to the individual developer. I'd make the build that your CI system is running the canonical build, but I do use Eclipse for my normal development.

I'd use Eclipse until such time as you are happy with the debug build. Then you can set up Ant to produce the signed release build.
You can set it up to use the same source files as Eclipse but put the output binaries outside your workspace. You can also set it to use your release.keystore, sign it automatically and obfuscate the code all in one go.
I've set it up to do this. I open a command line (DOS box) move to the projects home directory (\dev\projects\Eclipse\Project1 say), I type "Ant release" and the apk ends up in \dev\projects\AntBuilds\Project1\bin as Project1-release.apk.

If you want the best of both worlds, you might want to look at the m2eclipse-android-integration Eclipse plug-in which allows you to use your command-line Maven build in the ADT/Eclipse environment as well:
https://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/

Well for me im just a beginner, but I find eclipse much easier to work with. Android is a pretty complicated to get used to (for me) so having everything layed out in a GUI is preferable to command line. Plus SDK updates and such are easier to get.

Related

Android Build Server for a 1 Programmer "Team"?

Would you recommend the overhead of installing & configuring an Android build server for a 1 programmer project?
The alternative is to upload all sources from development computer to git, download to another computer with Android Studio & Android SDK, and build from Android Studio.
If the answer is yes, would you recommend Jenkins, or another solution?
IMHO, yes, if you have significant time to set it up and maintain it on a separate machine. (I personally would not use a shared machine: too many reasons to restart and disrupt it.)
I feel an extra level of confidence each time I check in if Jenkins builds the whole project successfully from a fresh dir (one less thing I have to do.)
If I forget to check in an important file, Jenkins complains. Or, if I code something that generates a new Lint warning, Jenkins puts a spike in the graph. In other words, on solo projects, Jenkins is like an assistant (or mentor) that helps check my work.
Jenkins can warehouse app installers for future reference. So, it also helps me stay organized.
Jenkins offers some nice communications capabilities too. You can have it automatically notify others via Slack, or put an installer on Dropbox, or, through a service like Zapier, create a custom card in Trello. So Jenkins gives me an outward-facing messenger and delivery service.
These are some plugins I have found useful with Android builds:
Android Lint
Credentials Binding
Environment Injector
Gradle
Slack Notification
ThinBackup
Version Number
Zentimestamp
Of course, this only scratches the surface.
It requires some ongoing maintenance work though. And sometimes it's confusing/challenging to configure. (e.g. some plugins are poorly documented or no longer actively maintained. The linter in Android Studio is not exactly the same as the default one run through gradle by Jenkins, etc)
When I first set my build server up, I had a couple weeks of downtime when I was able to experiment with different plugins and troubleshoot the server. I probably wouldn't have done it without that empty window of time at the start.

What are the differences between android studio and the eclipse version bundled with android SDK

I don't have experience in android development and I'd like to start writing an application.
The official developer tools page contains link to two different IDEs. The first contains a bundled ADT version of Eclipse.
Android Studio, the second IDE, is based on IntelliJ.
Apart from these differences I can't get if there is anything that I can do with only one of them (I guess the answer to this question is no) and what's the point of having two distinct official IDEs.
What are the differences between the two?
The first contains a bundled ADT version of Eclipse.
This is simply a packaging convenience. You are welcome to obtain Eclipse separately and add Android tooling to it.
Android Studio, the second IDE, is based on IntelliJ.
At the present time, this is an early-access preview. IMHO, it is not suited for someone who does not have experience in Android application development.
Apart from these differences I can't get if there is anything that I can do with only one of them
At the present time, Android Studio is an early-access preview, meaning that there are lots of things that it does not have integrated in. Now, by this time next year, and hopefully far sooner, Android Studio will have equivalent or superior integration than does Eclipse with the ADT plugin.
and what's the point of having two distinct official IDEs.
There are an infinite number of "official" tools. You are welcome to use a plain text editor and tools outside of any IDE, for example.
You are welcome to watch the Google I|O 2013 video on developer tools, where they describe a bit of the rationale behind the development of Android Studio.
Android Studio vs Eclipse – Main Differences:
Build Tools
Android Studio utilizes the fast growing Gradle build system. It
builds on top of the concepts of Apache Ant and Apache Maven but it
also introduces a Groovy DSL (Domain-Specific Language) that allows
for scripted builds which opens up many automation possibilities like
uploading your beta .apk to TestFlight for testing. Eclipse on the
other hand uses Apache Ant as its main build system which a very
robust XML based build system that many Java developers may already be
familiar with.
Advanced Code Completion/Refactoring
Both IDEs feature the standard Java code auto completion but in the
case of Android Studio, Google has baked in deeper support for
specific Android code and refactoring. Android Studio can refactor
your code in places where it’s just not possible using Eclipse and
ADT. In addition, in my opinion IntelliJ’s Java auto completion seems
more “intelligent” and predicts better what I want to do so there is
definitely an improvement in this area over Eclipse.
User Interface Design
One of the main selling point Google used to market Android Studio
when it came out was its completely redesigned user interface design
tool. After working with it for some time, it’s clear that the new
tool is much better than the old. It literally crashes it. The new
interface design too in Android Studio is faster, responds to changes
more rapidly and has more customization options that with Eclipse, you
had to manually set in the XML.
Project Organization
Both IDEs work differently in an effort to help you manage and
organize your projects. If you’ve used Eclipse then you must be
familiar with the concept of workspaces. When Eclipse starts, you
select the workspace that contains your projects and you can load all
project of that workspace in your tree navigation. If you want to
switch to a project in a different workspace, then you have to restart
the whole IDE. Android Studio treats this situation differently by
introducing the concept of modules. Your app could be one module, a
library that you just downloaded can be another and the Ad SDK you are
currently integrating could be a third. Each of these modules can have
their own Gradle build files and declare their own dependencies. To
me, Android Studio seems more natural but it takes some time to get
used to if you have been using Eclipse for a long time.
IDE Performance/Stability
Eclipse is a purely Java based software, and a big one. In order to
run it reliably you need to have more than decent amount of RAM and
good CPU power to back it up. Many user who do not strictly meet these
criteria are reporting very bad experiences with it. It is not unusual
for Eclipse to crash while exporting an apk or having to restart it
after using it for a few hours straight. Having said that, Android
Studio is still in beta so it comes with its own bugs that crash the
IDE every now and then but in the meanwhile, the whole experience
feels faster and more robust.
Conclusion
Having used both Android Studio and Eclipse for a while now, I would
personally say that Android Studio has the edge over the two. It might
be a bit unstable yet and some updates require a complete
re-installation of the software but when it eventually comes out of
beta, it will blow Eclipse with ADT out of the water. I especially
like the stability of the editor and not having to reboot every now
and then, the new and improved UI designer and the sexy themes that
make Android Studio a real eye candy. What side will you take in the
Android Studio vs Eclipse battle?
Besides the numerous points already made, while you can use the ADT tool for other projects outside Android, the Android Studio is purely dedicated to the development of Android apps.Android Studio also allows you to work faster as it gives you intelligent suggestions as you type, freeing you from the shackles of having to go back to your .java or .xml files to look up names of variable or other stuff you can't remember.I just started using Android Studio myself and i can say i am never leaving it.It is particularly good for new programmers.

Use Sublime Text 2 to develop Phonegap applications for Android

I've been using eclipse to develop Android apps with phonegap until, a few weeks ago, I decided to try Sublime Text 2. I found it to be so much better than the eclipse editor so I would like to keep using it. Only thing I'm missing is a quick way to test the app on the device inside Sublime.
Luckily, someone else also had the same idea and developed a plugin for this:
https://github.com/Korcholis/Andrew
Sadly, I cannot get it to work, I installed ant and pointed the plugin to adb but then nothing happens when I try to create a new project (and there is no error message in the console).
I also found this other plugin:
https://bitbucket.org/ucomesdag/sublime-android
But I have no idea on how to install and run it.
Did someone else found a way to do this?
A quick update into 2014.
As of PhoneGap Cordova 3.0, it is no longer required to develop Android apps via eclipse. You are free to use any code editor or IDE you wish as app building is done independently from eclipse via a simple command line.
cordova run android to package the .apk and install on any active devices detected by adb or
cordova build android to package the .apk only.
In your case, you can keep using Sublime and pop in the cordova run android command whenever you ready to go on a test run.
While I agree with Insane Coder that you should stick with supported IDEs to develop for Android, according to this link and existing Sublime Text 2 Ant support, you could build and develop your android project with this IDE (It will just take some time to set it all up... as opposed to using a supported IDE like IntelliJ or Eclipse).
Using PackageControl, look for "Ant". That will install syntax highlighting for Ant. Another plugin that enables the build command (ctrl+b) to work for Ant files, "Super Ant". You should be able to code for android in sublime text 2 with those installed.
On another note... Do you use windows? The Andrew project you link to, seems to have Windows compatibility issues. Apparently related to locating the "SDK" (he says sdk in Andrew's github page but, probably he means JDK?) in your hard drive. Which is probably a hassle because Windows typically installs stuff to "Program Files" and in code, that turns into "Progra~1" because of the space. In the link I give you there is another approach to it, so when you install the JDK set a folder that has no spaces in its name, like c:\java\jdk1.6.0_02 or something else that strikes your fancy. The problem you could be having with Andrew is that it isn't finding the jdk in your hard disk.

Build/Package Android application with rake?

Is it possible to build an android application with rake? The only other question on this subject I saw was a while back and someone advised using Gradle.
So is there any way to do this on the command line, as I am sure under the hood eclipse just runs a lot of command line guff to get the apk file generated then spits it to the device, I just want to generate the apk file (there is alot of other things to be done but these are prior to the APK building).
Is it possible to build an android application with rake?
Yes, insofar as it is possible to build an Android application using Ant, and rake can in theory do everything Ant can.
If you are expecting to find an existing rake script, though, you will likely be disappointed. The Ant scripts necessary to build an Android app are rather substantial, and porting all of that to rake will take quite some time. And, then, they will perpetually be out of date, as those Ant scripts are often modified with Android tools releases.
Here's a small example project that's worth a look: https://github.com/jberkel/android-helloworld-rake
I've been meaning to try it out myself.

Is it possible to use the Android SDK without using eclipse?

I'd like to develop for Android but I don't really like using an IDE for programming as I find them to be pretty cumbersome compared to a text editor and command console. Is there any way I can develop for Android without doing so in Eclipse, and instead using Gedit? The system requirements specified on the Android developers site list Eclipse as a requirement, but I Ewas wondering if anyone had found a way to manually tap into the SDK libraries outside of Eclipse. I'm using a Linux setup as my development box.
You do not have to use Eclipse, it's just highly recommended because the tools are nicely integrated :
The recommended way to develop an
Android application is to use Eclipse
with the ADT plugin. The ADT plugin
provides editing, building, debugging,
and .apk packaging and signing
functionality integrated right into
the IDE.
However, if you'd rather develop your
application in another IDE, such as
IntelliJ, or in a basic editor, such
as Emacs, you can do that instead. The
SDK includes all the tools you need to
set up an Android project, build it,
debug it and then package it for
distribution. This document is your
guide to using these tools.
See this page on the Dev Guide for more info: Developing In Other IDEs
Yes you can do it with just the SDK and Ant (and the JDK of course). I'm doing it right now as an exercise in relearning Ant, and to make an 'idiot push button' procedure for a release build.
I've got to say that it's slow going just trying to configure the build process on sources that I know will compile. I'm glad that I've got Eclipse for the rapid development in the debug phase.

Categories

Resources