As most developers surely have, we’ve spent a lot of time digesting all the news and info from Google IO (read our brief review of it) and the accompanying seminars. In particular we took great interest in the upcoming improvements to Android Studio.
Most of the features we’ll explore in this article will be coming in Android Studio 1.3 but some may come later, perhaps as late as Autumn 2015 in 1.5.
Although no release dates are specified (at time of writing), you can see lots of the new features in the previews of 1.3 (on Canary channel).
First up (and worth significant rejoicing); Vector drawables. YES!
Soon you’ll be able to use SVG files instead of adding 4-5 different bitmaps in different sizes. This should save you / your designer a lot of work and the hassle of making sure you have the right quality and size of image - now Android is going to do all that hard work for you.
This also has the benefit of reducing the overall APK file size and means you can add color tints/filters more successfully.
This will basically give you an interface through which you can see live previews of what your theme will do. i.e. you will have examples of widgets like checkboxes in front of you and then you will be able to change aspects of your theme like the primaryColor and that will change all the widgets in real time to reflect that.
Imagine it like you managed to open the theme.xml file and see it in the same way as you see your 'mainactivity.xml' file in the layout editor.
One of the possible new features here is a blueprint mode for your layout making it easier to see what going on with your alignments and margins etc.
Android design support library will be added, which in essence means you can add the lollipop design features such as FABs (Floating Action Buttons) into your layout much easier than before (drag and drop). As always it is backwards compatible.
Also added is the ability to view a live version of system preferences, similar to how you view your normal layouts.
The preview mode where you get the xml on one side and a preview of what that looks like on the other will be changing so that the preview is now the layout editor, i.e. it is intractable not just a preview.
So, essentially you can put your xml and layout editors side by side and they update each other in real time.
So, what new dev tools can we look forward to?
Performance upgrades include a different compiler (changed to JACK) and other bug fixes and improvements. Put simply - building is much quicker than before.
Gradle has been improved and this will also make building quicker. Also, further improvements to Gradle are still in the pipeline, including caching. So, Gradle will no longer build things that haven't changed (phew). BUILDS SHOULD BE FAST!
With binding you set an activities layout using a binding method and then you can just access widgets and views from that layout. You’ll just need to use simple code like
mainActivity.textView1 and the
findViewById stuff is gone because Android handles it for you in a fast and thread safe way.
Now, in the layout we can create variables and imports (similar to what you would do in the Java file). This means you can now do things like:
Which is where you can access your activities methods and variable and use them to set attributes in the layout file itself. It essentially cleans up all the setting up stuff and enables you to do cool things with RecyclerViews with auto filling the data and other similar layouts.
We’re super impressed with the seemingly well thought through NDK experience (IDE CLion from JetBeans) with editing and debugging in mind.
A similar experience to normal java editing can now be used on the C++ files including refactoring, finding and code completion, but with extra C++ features (for example export into macros)
Also, some great features for JNI development (Java Native Interface, the interface between the C++ parts of your app and the Java parts), namely find usages and declaration work across the JNI link and some great create quick fixes.
Another great improvement are the new annotations for easier debugging and, hopefully, to stop you from making the mistakes in the first place. These have also been implemented throughout the android libraries, for example @WorkerThread has been added to AsyncTask.
Threading annotations – for example the new @WorkerThread annotation which means that the editor knows this is a worker thread and hence if you did something like update a UI element you would get a warning.
Size annotations – to set min, max and multiples so that for example if you set a string too long you'll get a warning
Range annotations – to ensure you set a value between a certain range, for example an alpha value must be between 0 and 1 so you will get a warning if it was set out of that range.
Check result annotation – Tells the client that they should do something with the returned value.
Call super annotation – Tells whatever invokes your method that they better call super.
Color Int annotation – Tells you that this int represents a color.
Requires permission annotation – This allows you to set that a certain method requires a certain permission. This ties in with the new permissions changes.
Now they have added a feature which allows you to know what those damn ints mean. For example, if you have a flag which you set, you can now ask Android (in the debugger) what that flag means. Also, if you have an int which is the id of a text field you can ask Android to work that one out and it will tell you that that int corresponds to a '@android:string/ok'.
According to Google, the emulator can be fast. This is of course as long as it is configured properly and Google claim that for a whole lot of people it's not. Oh.
Thankfully now Android Studio does that for you.
Also, they've improved the GL renderer and an Android auto emulator has been added.
Cloud Test Lab – You will be able to upload your app on the Google Dev Console and they will run automated tests on it on different devices (from around the world). It will give a report on crashes and screen recordings.
You will now be able to setup your test in a different module in Gradle.
The integration of developers services will help you to properly set up their services.
In a nutshell, they auto generate all their recommended code (from the quick start guides) for that service. This will help you to be sure it is set up properly and saves you copy and paste time (and errors).
The SDK will now be properly integrated into Android Studio. This means that they are able to give notifications when updates come out, helping you to stay on top of the latest and greatest APIs.
In conclusion; the improvements which are coming up for Android Studio are very exciting. Development should be quicker and easier to get right first time.
I am especially interested in the new DataBinding side of life and look forward to hopefully utilising this in my code in the near future.
Hopefully that has given you a good breakdown of what is to come for Android Studio and has fueld your excitement for new features that tie in to Android M.
Search over 300 blog posts from our team
Subscribe to our monthly digest of blogs to stay in the loop and come with us on our journey to make things better!