Using Android Studio - Developer

  • Published on
    30-Jan-2016

  • View
    214

  • Download
    0

DESCRIPTION

November 4, 2015 Hot Topics: prev Android Java Microsoft & .NET Cloud Open Source PHP Database next Java Microsoft & .NET Mobile Android Open Source Cloud Database…

Transcript

November 4, 2015 Hot Topics: prev Android Java Microsoft & .NET Cloud Open Source PHP Database next Java Microsoft & .NET Mobile Android Open Source Cloud Database Architecture Other Slideshows Cloud Center Project Management PHP Perl Ruby Services Other Languages White papers Research Center NEW: Slideshows Developer.com Mobile Android Read More in Android » Using Android Studio March 4, 2015 By Chunyen Liu Bio » Send Email » More Articles » Tweet Android Studio is now the only official development tool that will support the full-featured Android SDKs in the future. If you are like myself, skeptical about the beta release or reluctant to get away from the popular IDE in Eclipse for the past several years, the wait is over. This is about the right time to move towards Android Studio if you would like to continue to enjoy new upcoming Android features offered by Google. The reason is simple: Google will no longer provide updates for the Eclipse plug-in or ADT (Android Development Toolkit) and will only release new SDKs for its own Android Studio. In this article, we will briefly cover some key topics, such as where to get the download, how different it is from Eclipse, how to import/export/create projects, basic signing tools, and some useful shortcuts to make your development time easier. Installation and Feature Overview The Android Studio download package, available at https://developer.android.com/sdk/index.html, contains everything required for your app development and more, including the IDE itself, SDKs, Wearable Platform, Cloud Platform, Google Services, and so forth. The Installation wizard will guide you through step by step, so the process should be a breeze. There are numerous neat features offered by Android Studio. I'll just comment on some of them from my own development's perspective: Gradle: This is probably the most noticeable difference for avid Eclipse users. It is a very flexible build system that can create multiple targets for your app with various features by the same project and modules. It also can customize and configure the build process.See the project view in Figure 1. Cloud integration: You can use the Google App Engine to connect to the Google cloud with minimal effort. Executive Viewpoint: Choosing Your Connection to the Cloud Download Now lint: It identifies performance, compatibility, and other problems. Dynamic layout view: The layout editor allows you to drag and drop user interface controls into your layout and preview it while editing the XML. Figure 1: Project View Android Studio vs. Eclipse with ADT Post a comment Email Article Print Article Share Articles Digg del.icio.us Slashdot DZone Reddit StumbleUpon Facebook FriendFeed Furl Newsvine Google LinkedIn MySpace Technorati Twitter YahooBuzz Many developers have been using Eclipse with ADT for their main app development, so it should be beneficial to know what the key differences are while migrating to Android Studio. First off, many external tools often used are under "Tools->Android->" as in Figure 2, including "SDK Manager" to get the latest SDKs and "AVD Manager" to configure your virtual devices. Figure 2: External Tools The one major difference between Android Studio and Eclipse is the gradle build system offered, as you can see in Figure 1. These new build files are in plain text. They are confined to syntactic rules and used to configure the build with the elements. Very often, when you actually need to hand-edit these files, you only work on them at the module level. Even more often, you don't even need to touch these files at all, but it doesn't hurt to browse through them occasionally for a better understanding of what modules could be involved. Android Studio embeds a powerful layout editor for you to drag and drop controls into your view and preview on many different devices at the same time. See Figure 3. Related Articles How to Start an Activity in a Different Android App Getting Notifications from Android Wearables A Quick Primer on the Top Android 6.0 Marshmallow Features Working with Intents in Android Apps 10 Android UI Design Tips to Improve Your App's Visual Appeal Packaging and Distributing Apps for Google Play Google Play Revises Developer Policies Figure 3: Layout Editor Integrating Google Cloud into your app is as simple as doing it through "File->New Module...->Google Cloud Module", as in Figure 4. Figure 4: Google Cloud Importing, Creating, and Exporting Projects To import the existing Android projects not created by Android Studio previously is pretty straightforward; simply select "Import Non-Android Studio project" from the "Welcome to Android Studio" dialog, as shown in Figure 5. Basically, the process will generate the gradle build files and organize all the files with the specific folder structure. Figure 5: Import Exporting a project from Android Studio to something Eclipse-compatible is a cumbersome task for now because it requires some manual processing work. Moving forward, new projects should be all compatible with Android Studio, so exporting a utility becomes not as necessary. For those who really want the conversion done, please find the info in the references. Creating a new project is simply as easy as selecting "Start a new Android Studio project" from the "Welcome to Android Studio" dialog and you will come to the page similar to Figure 6. As you can imagine, there are some occasions when you want your app to run on multiple devices (for example, wearable and mobile modules), so you will be asked to specify their respective SDKs and options. Their templates and gradle build files will be generated and managed through the project settings. Figure 6: New Project App Signing Before Publishing Before you can publish your app for public consumption, you need to sign it with your own certificate; in other words, key store that uniquely identifies you as the author. Assume you already know how to create a free key store. Android Studio offers you the choice to sign a specific app apk file every time manually as well as insert the app signing into the build process. I would recommend you at least set up the automatic signing for the release build type. The manual app signing is through "Build->Generate Signed APK...". The automatic process is set up through right-clicking on the app and selecting "Open Module Settings". Use the "Signing" tab to configure the key store; for example, "signing1" in our example illustrated in Figure 7. And then switch to the "Build Types" tab and select the configuration we just created, as in Figure 8. Figure 7: Auto App Signing Configuration Figure 8: Auto App Signing Selection Conclusion This is a short introduction to the official IDE in Android Studio. It is the only IDE that will receive future Android SDK updates for now, so migrating to this tool becomes a must-do. As developers, we all have our own favorite shortcuts to speed up some development effort. Here are some from my list: Ctrl-Alt-L: Reformatting the codes for files or selected text File->Settings->Editor->Auto Import: Auto-importing the class packages by enabling "Insert imports on paste All", "Optimize imports on the fly", and "Add unambiguous imports on the fly", as in Figure 9. Alt-Enter: Fixing common project errors automatically or making suggestions Ctrl-G: Going directly to the line Ctrl-Shift-N: Finding symbols by name For more advanced developers using NDK, you will also need to configure gradle build files specifically for that purpose. Figure 9: Auto Import References Android Developers at: http://www.android.com/developers/ Android Devlopment Center at: http://www.developer.com/ws/android Androidlet at http://www.androidlet.com Importing from Android Studio into Eclipse About the Author Chunyen Liu has been a software professional in Taiwan and the United States. He is a published author of 30+ articles and 100+ tiny apps, software patentee, technical reviewer, and programming contest winner by ACM/IBM/SUN. He holds advanced Computer Science degrees and trained in 20+ graduate-level courses. On the Reply to this comment non-technical side, he is a certified coach, certified umpire, and rated player of USA Table Tennis, having won categorized events at State Championships and US Open. Tags: Eclipse, Android, IDE, SDKs, Google Cloud, android studio, Gradle 1 Comments (click to add your comment) By louis March 04 2015 11:56 PST first! super! Comment and Contribute Your name/nickname Your email Subject (Maximum characters: 1200). You have characters left. Enterprise Development Update Don't miss an article. Subscribe to our newsletter below. Most Popular Developer Stories Today This Week All-Time 1 Using JDBC with MySQL, Getting Started 2 Creating Use Case Diagrams 3 An Introduction to Java Annotations 4 Hibernate Basics 5 Using ASP.NET To Send Email 1 Using JDBC with MySQL, Getting Started 2 10 Experimental PHP Projects Pushing the Envelope 3 Hibernate Basics 4 An Introduction to Java Annotations 5 Oracle Programming with PL/SQL Collections 1 Using JDBC with MySQL, Getting Started 2 Hibernate Basics 3 Oracle Programming with PL/SQL Collections 4 An Introduction to Java Annotations 5 Creating Use Case Diagrams Most Commented On Privacy & Terms This Week This Month All-Time 1 10 Experimental PHP Projects Pushing the Envelope 2 Day 1: Learning the Basics of PL/SQL 3 C# Tip: Placing Your C# Application in the System Tray 4 Logical Versus Physical Database Modeling 5 Is Ubuntu Contributing as Much as It Should to Free Software Projects? 1 Day 1: Learning the Basics of PL/SQL 2 The 5 Developer Certifications You'll Wish You Had in 2015 3 10 Experimental PHP Projects Pushing the Envelope 4 An Introduction to Struts 5 Inside Facebook's Open Source Infrastructure 1 Creating Use Case Diagrams 2 Day 1: Learning the Basics of PL/SQL 3 C# Tip: Placing Your C# Application in the System Tray 4 Using ASP.NET To Send Email 5 Using JDBC with MySQL, Getting Started Recommended Partner Resources Cloud Computing Showcase for Developers Mobile Development Center HTML 5 Development Center Top White Papers and Webcasts EMA Report: Optimizing Cloud for Visibility, Control, and Performance with Application Discovery and Dependency Mapping Complex hybrid environments can make it difficult to track interdependencies, increasing the risk of disrupting critical business services. In this white paper by EMA, you'll learn how application discovery and dependency mapping can help you: Meet granular targets for availability, cost, and time-to-revenue for cloud services. Accelerate mean time to repair (MTTR) while communicating better with stakeholders. Manage even the most complex hybrid environments more efficiently and effectively Understand the ⦠Static Code Analysis in an Agile World To keep pace with ever-increasing customer demands on software functionality and time-to- market expectations, software developers are having to develop higher quality code faster. As a result, Agile development is becoming more common. However, to fully realize the benefits of Agile, a repeatable process for ensuring code is free of defects and security vulnerabilities is critical. This paper examines how source code analysis can enhance the Agile development process and empower Agile teams. Sitemap | Contact Us Property of Quinstreet Enterprise. Terms of Service | Licensing & Reprints | About Us | Privacy Policy | Advertise Copyright 2015 QuinStreet Inc. All Rights Reserved. Thanks for your registration, follow us on our social networks to keep up-to-date

Recommended

View more >