##1 Before switching to Android Studio
I have written this guide to cover the basics of what you need to know before migrating your Eclipse projects over the Android Studio. If you have a large and gnarly project to migrate from Eclipse over to Android Studio, consider saving time by booking an hour or two with an AirPair expert who has done it before. Otherwise, read on!
##2 Say Good-bye To Work Spaces And Sub-Projects
In Eclipse, you are probably familiar with the concept of a "Workspace." You likely even have an Android project currently which includes multiple component projects and libraries which are compiled into ".jar" files and included in the final resulting application. In Android Studio, projects are replaced with a new concept called "Modules" and "Library Modules."
##3 Hello Modules
Modules are a "discrete unit of functionality that can be run, tested, and debugged independently" and are somewhat similar to an Eclipse project with a few key differences.
Each Module needs to have it's own Gradle build file(generally automatically generated for you when you create a new one, otherwise you can generate them if you are exporting a project from Eclipse). These Gradle files contain important details such as supported Android version ranges, dependencies and other meta-data about your Android project.
Just like in Eclipse, some Modules may be "Library Modules" which are conceptually the same as "Library projects."
##4 Hello Improved Interface Designer
Android Studio features a new and improved interface design perspective where you can view the interface you are working on and its related components.Eclipse also has a similar design perspective so it shouldn't be too big of a shock for you. In Eclipse, a "perspective" is used for providing views and visible actions, as well as delivering mechanisms for interaction with resources, multi-tasking and information filtering.
##5 Including Jar Dependencies
Like Eclipse, you will often need to link to JAR files created by 3rd parties. However, you will now need to get used to adding these .jar dependencies to your Gradle build file. Just like Eclipse, you will keep these .jar files in a "libs" folder at the root of your module (e.g. project) directory.
Simply "Right-Click" .jar files in your "libs" directory and select "Add As Library" and your selected JAR files will automatically be added as Gradle dependencies in the relevant build.gradle file for your Module. Make sure to always click "Sync Gradle" to ensure the project has been properly notified of the new dependency on these modules.
##6 Adding Module Dependencies
Just like in Eclipse, one Module may depend on another Module. Follow these instructions to establish a dependency between two modules and Android Studio will automatically generate the necessary Gradle entries you will need.
##7 Manifest Destiny
One major change you will need to get used to with Android Studio is that several common items and settings which once lived in the Android Manifest now are either automatically added (as in the case of the "debuggable=true" flag indicating an Android application may be debugged) or have been moved to build.gradle such as version codes and API min / max specifications. Feature and permission requirements, however, must still be declared in the Manifest as before (e.g. "permission: camera" and so on).
##8 Get Help From An Android Expert
One thing that may be helpful is to enlist the help of a seasoned Android Studio expert to walk you through the nuances of the new IDE. Put in a request on AirPair to get paired with an expert - You will likely be surprised by how much ground you can cover in a short period of time talking to a real person.
##9 Migrating From Android Studio
Read my guide on how to migrate from Android Studio to Eclipse to get specifics on the mechanics of exporting and importing an existing Eclipse project over to Android Studio. There are a number of potential issues that can occur along the way which I won't go into extensive detail on here.
##10 Gradle Basics
The addition of Gradle is going to be your largest hurdle during your transition over to Android Studio. Here are the basics of what you need to know:
- Your Android Studio project will have a settings.gradle for the whole project
- The settings.gradle file includes references to all modules which are included in the project and is generally updated automatically when you import or create a new module
- Each Android Studio module will have its own build.gradle file
- If one module depends upon another module, you will need to add that dependency in the build.gradle under the dependencies section
- If your Module requries a jar file, it must be listed in that Module's build.gradle file
- You may add remote dependencies to your project by listing them in a module's build.gradle file
- From time to time, you will need to manually edit these gradle files Read more about Gradle over here.
##11 Unit Testing
Android Studio comes complete with support for JUnit unit and Android tests, read more here. Setting up and running Unit Tests involves creating a few test classes and adding them to your project's run configuration. Follow the linked guide for more specifics. Popular testing frameworks such as Roboguice are not quite supported at this time but it wouldn't surprise me if they are in the near future.
##12 Importing Remote Dependencies With Maven
Android Studio allows you to import remote library files from Maven Central. Browse Maven Central for remote libraries you might be interested in and follow these instructions to ensure these dependencies are automatically downloaded at compile time.
So those are the basics of what you need to know. Android Studio is under rapid development and seems to be getting better every week so go check it out.
=======================================================
Most of Google’s 2013 I/O event was about Android. One specific announcement managed to attract a lot of hype and that was no other than Google’s own Android IDE, Android Studio. It has been just over a year now since the first public release and Android Studio has come a long way, despite still being in beta. The IDE itself is based off the very popular IntelliJ IDEA from JetBrains and is being offered by Google for free.
On the other hand, Eclipse is more mature than ever and Google’s ADT plugin which transforms the popular IDE into a fully featured Android developing environment has become very stable. Eclipse feels like home for many Java developers and is a natural starting point for Java developers who want to get into Android development.
While both solutions look promising, which one has the edge over the other? In this blog we will compare the two in 5 distinct areas in an effort to reveal the main differences in the Android Studio vs Eclipse battle.
While both solutions look promising, which one has the edge over the other? In this blog we will compare the two in 5 distinct areas in an effort to reveal the main differences in the Android Studio vs Eclipse battle.
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 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 be1 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 Ecli1pse 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?
No comments:
Post a Comment