Android Studio vs Eclipse ADT

Jyotishgher Astrology
By -
1

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 auto1 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 Design2

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 esp1ecially 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?

ANDROID STUDIO -----------------_-

1. GRADLE PROJECT STRUCTURE

Android Studio introduced a new project automation tool - Gradle, which replaced Apache Ant. Have you ever tried to upgrade your Ant version while developing an Android application and cried in agony when your project exploded into millions of pieces? Upgrades are always frustrating and in 9/10 cases you have to modify Ant scripts or your project to bring it back to life.
Gradle also allows you to use different flavors of an application - you can define separately the development and production version. You don't want to use Proguard and have different app icons in the dev and prod version? Just modify your build.gradle file.
Gradle structure
Fig 2. Separate your development and production resources

2. SMART SHORTCUTS

Android Studio replaces references to resource files with their real values, so you can find out which color you are using or what is the height of the layout directly from the code editor.
Colour preview
Fig 3. Which color should I use?

3. IMPROVED GRAPHICAL PREVIEW

I've always experienced a lot of problems while using graphical preview in Eclipse. In Android Studio you can build layouts and observe changes in real time. Heck, you can even track these changes on different screens!

4. LINT

Android Studio uses Lint by default, and you can modify your Gradle files to include Lint when releasing your APKs - if Lint finds some warnings, it will automatically abort your release process.
Why is this good? It forces you to use good Android development practices (like defining all of your dimensions in separate XML files, or avoiding hardcoded strings), it can point to unused resource files (which results in a smaller APK file in the end), mistakes or unused permissions in the manifest file etc. We want to speed up our development process, but we also want to produce quality code.
Lint error
Fig 4. So you want to use dp instead of sp? Not on my watch...

5. UNIT TESTS

One of the most important steps in software development is testing - you want to avoid bugs and errors. In Android Studio you can define your unit tests in separate classes and launch them while building your applications. In case of an error, you know where your bugs are even before they happen in production.

6. SPEED

Android Studio is fast - and by fast I mean really fast. Just for comparison - in Eclipse you need at least one or two minutes for building release versions of more complicated projects. In AS you can build the same project in less than 30 seconds.

Dawn of a new era

In conclusion, in less than a year, Eclipse lost its position as the primary IDE for Android development and became extinct. By the mercy of the heavenly Gods of Java, we have also fought in this war, alongside other developers.


Generating APK in android studio

hanging the Build Variant

The first step in the process of generating a signed application APK file involves changing the build variant for the project from debug to release. This is achieved using the Build Variants tool window which can be accessed from the tool window quick access menu (located in the bottom left hand corner of the Android Studio main window as shown in Figure 54-1).

Launching the Build Variants tool window in Android Studio
Figure 54-1

Once the Build Variants tool window is displayed, change the Build Variant settings for all the modules listed from debug to release:

Configuring Build Variants within Android Studio
Figure 54-2

The project is now configured to build in release mode. The next step is to configure signing key information for use when generating the signed application package.

Creating a Keystore File

To create a keystore file, select the Build -> Generate Signed APK… menu option to display the Generate Signed APK Wizard dialog as shown in Figure 54-3:

The Android Studio Generate Signed APK Wizard dialog
Figure 54-3

In the event that you have an existing release keystore file, click on the Choose existing… button and navigate to and select the file. In the event that you have yet to create a keystore file, click on the Create new… button to display the New Key Store dialog (Figure 54-4). Click on the button to the right of the Key store path field and navigate to a suitable location on your file system, enter a name for the keystore file (for example release.keystore.jks) and click on the OK button.

Configuring private signing key information in Android Studio
Figure 54-4

The New Key Store dialog is now divided into two sections. The top section relates to the keystore file. In this section, enter a strong password with which to protect the keystore file into both the Password and Confirm fields. The lower section of the dialog relates to the release key that will be stored in the key store file.

Generating a Private Key

The next step is to generate a new private key which will be used to sign the application package. Within the Key section of the New Key Store dialog, enter the following details:
  • An alias by which the key will be referenced. This can be any sequence of characters, though only the first 8 are used by the system.
  • A suitably strong password to protect the key.
  • The number of years for which the key is to be valid (Google recommends a duration in excess of 27 years).
In addition, information must be provided for at least one of the remaining fields (for example your first and last name or organization name).

Configuring private signing key information in Android Studio
Figure 54-5

Once the information has been entered, click on the Next button to proceed with the package creation.

Creating the Application APK File

The next task to be performed is to instruct Android Studio to build the application APK package file in release mode and then sign it with the newly created private key. At this point the Generate Signed APK Wizard dialog should still be displayed with the keystore path, passwords and key alias fields populated with information:

Keystore file and key information configured in Android Studio
Figure 54-6

Assuming that the settings are correct, click on the Next button to proceed to the APK generation screen (Figure 54-7). Within this screen, review the Destination APK path: setting to verify that the location into which the APK file will be generated is acceptable. In the event that another location is preferred, click on the button to the right of the text field and navigate to the desired file system location.

Generating a signed APK file in Android Studio
Figure 54-7

Enable the Run ProGuard checkbox (ProGuard performs a series of optimization and verification tasks that result in smaller and more efficient byte code) before clicking on the Finish button. At this point the Gradle system will compile the application in release mode. Once the build is complete, a dialog will appear providing the option to open the folder containing the APK file in an explorer window:

Android Studio signed APK file generated
Figure 54-8

Post a Comment

1Comments

Post a Comment