This post was originally published at Android Studio templates now available for Corona Enterprise

As of Daily Build 2016.2886, Android and iOS development for Corona Enterprise are finally on equal footing; Android Studio support for Corona Enterprise is here!

Google released Android Studio 1.0 as the official IDE for Android Development in December 2014. This change brought several useful tools to the Android development landscape, but focused around the development of standard Android applications.

For Corona Enterprise on Android, we simply relied on the Android command line tools and custom scripts for doing Enterprise development; no IDE integration whatsoever. This left Android Enterprise developers with very few tools to iterate on code quickly and the whole process more painful than it had to be.

What about the old project model?

Just as Google moved away from the Ant build system, so are we. Android Studio is the present and future; this is where we want to be.

Now that Android Studio templates are available, the Ant project templates have been deprecated and all new Enterprise projects should use Android Studio.

Despite being deprecated, documentation for using Enterprise with the Ant build system will still be available through around September or October of this year.

Getting started with Android Studio

If you’re new to Corona Enterprise or Android Studio, see our Android Prerequisites guide for instructions on how to set up Android Studio for Corona Enterprise development.

Migrating to Android Studio

For existing Android Enterprise projects, see our Migration to Android Studio guide. We will be dropping support for the Ant project model in the coming months. Specifically, the public release in September/October will mark the end of Ant project support for Corona Enterprise. Please have all of the Enterprise apps that you’ll continue to support migrated by this time.

How Android Studio makes development easier

Android Studio brings several useful tools that make the Android Enterprise developer’s life much easier. Some of these include:

Code completion

Can’t remember what that exact Android API was? No problem – Android Studio’s got you covered!

Static Code Analyzer

This handy tool can inspect Java code throughout your project and help you catch possible bugs, simplify complex code snippets, find coding style issues, typos, and so much more. We highly recommend giving this a run via Analyze → Inspect Code…

JAR Decompilation

Ever been in a situation where your app is crashing inside some library that you don’t have the source code to? Assuming that library isn’t obfuscated with ProGuard, the JAR decompilation tool will let you take a peek into the implementation for better understanding of the library.

Integrated support for Android Virtual Device (AVD) testing

While it was possible to test out Corona Enterprise projects using Android Virtual Devices (AVDs) before, Android Studio makes this significantly better by offering improved performance and easy integration into the IDE.

Testing with AVDs does come with some caveats you should be aware of:

  • Since Corona is built with the ARMv7 architecture in mind, be sure to only use system images with ABI: armeabi-v7a.
  • AVDs do not have Google Play installed on them. This means that testing things like Google Licensing, Expansion Files, or IAP cannot be done in AVDs.
  • AVDs are a little slow to boot. Be patient and don’t accidentally close one AVD after running a single test.

No more command line

You can now do all building, deployment, and view logcat through Android Studio. No need for shell scripts!

No guessing at API Levels for Android APIs

Android Studio warns you if you use an API that was introduced later than your minSDKVersion. No more redesigning for older Android versions at the last minute.

Easier integration of common external libraries

While this doesn’t apply to libraries that are only distributed as JAR files, Android Studio makes it significantly easier to add things like the Android Support libraries and Google Play Services to your projects.

A simple line in the dependencies block of your build.gradle script it all it takes for adding in whichever version of the Android Support libraries you desire:

For Google Play Services, you can even select which components of it to compile into your app. This is especially helpful if your app is getting close to the method reference limit for a single dex file.

Multi-dex support is now easy as pie

This can now be added to Corona Enterprise projects using the simple steps outlined by Google here.

Testimonials

Still not convinced that Android Studio is the best thing since sliced bread? Read these testimonials from our engineers:

  • “I don’t have to switch between Sublime Text and the Terminal 200 times a day now!” — Danny Glover
  • “It’s like Xcode for Android….but better.” — Ingemar Bergmark
  • “The only disadvantage of using Android Studio over the old Ant method is… oh, well, there is none.” — Sergey Lerg

Regarding AVD testing

If you’re giving AVD testing a try for the first time with Android Studio, there are some best practices you should be aware of:

You should use AVD testing for:

  • Testing UI on form factors that aren’t readily available to you. While Google’s Android Cloud Test Lab does allow some form of UI testing, you’ll be able to iterate faster using AVDs.
  • Testing with OS versions that aren’t readily available to you. If your app is using some APIs or features that aren’t available on all the API Levels you support, this is a good way to quickly test behaviors on any questionable API levels.
  • Testing situations that are difficult to set up on actual devices. The emulator that AVDs run in allow you to mock up situations that may be more difficult to test on real hardware. For example, you can mock up the battery state and phone calls.

You should not use AVD testing for:

  • Performance testing. Because this is an emulated environment, the performance you see with an AVD is not the same as what you’ll see on real hardware. For bigger apps, testing in this manner may not produce usable/practical results.
  • As a substitute for on-device testing. You should make sure your app works on a plethora of actual hardware before submitting it anywhere.

For more info, consult Google’s Managing AVDs with the AVD Manager Guide.

Jump to original:  

This post was originally published at Android Studio templates now available for Corona Enterprise