Saturday, August 24, 2013

Android New Build System (Gradle)

At Lolay we've now started and are using the Android "New Build System" on 3 projects with success.  We are using a combination of using Android Studio and Gradle with the Android Gradle Plugin. Overall, it was a good decision and it's been worth the time investment as well as minor bugs with Android Studio.

For a background, prior to this for Android development we would use Eclipse, Maven, Maven Android Plugin and the Eclipse m2e Plugin (And we've also used IntelliJ). We're not huge fans of Eclipse, but it is the most popular IDE for Android development (probably not for long). Using Maven, Android and Eclipse together is not an easy experience, and typically had lots of issues. This would particularly be true where the IDE build worked, but the Maven build did not (or vice versa).

One of the things we did like with the Maven builds was the ability to support building a Development, QA, Beta and Release version of an application all of which would use different server URL's, different Flurry codes, etc. This allowed a sophisticated setup. The only problem is this caused a lot of duplication and Android Manifests to obtain this result (we settled on using Maven profiles to point to alternate Android Manifests). This all worked, but was difficult to maintain.

Enter the "New Build System" with Android Studio. First, Android Studio is an absolute pleasure to use. It's as good as the Google I/O talks present. It's also very stable for a Beta version of the product, although this is most likely a result it's really based on IntelliJ and IntelliJ's Android support under the scenes, which was already pretty robust. The Android Plugin for Gradle is also very stable, and this is most likely a result of being able to learn from the Android Plugin for Maven.

One of the nice things about using Android Studio and Gradle with the Android Plugin is it has direct support for building multiple versions of an application. We are now building Debug, QA, Beta and Release version of the application and use different buildTypes to support each one. It's very natural, and it supports modifying your single Android Manifest so that we no longer need to have multiple manifests. In addition, it has a nice "overlay" feature where code and resources in src/main can be overlayed by content/settings in src/{buildType}. This allows us to have have a src/debug/res/values/strings.xml to add in environment specific URL's or Flurry codes. It also allows us to have an environment specific icon in src/debug/res/drawable/ic_launcher.png.

We've also have the great benefit that both the IDE and command line both use Gradle for the build, so that we no longer get issues where an engineer says "works fine built from Eclipse".

The only issue we've run into with the "New Build System" are that occasionally on an Android Studio upgrade it can break something in the project (I'm speaking to you 0.2.4). We've learned to make sure we have a time machine backup before applying any Android Studio upgrade). But, even when this does occur we could build the project command line and edit with a basic text editor like Text Mate to get the build out.

Android Studio and the Android Plugin for Gradle are mainstream enough and stable enough that we recommend all projects switch over to it.

18 comments:

  1. Thanks for your informative article. As the demand quality apps and games increases in the mobile market, there is huge demand for the android developers in the job market. It is recommended to go for Android training to boost his/her career prospects.

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Excellent post. Android is an open source operating system used for tablet computers and smartphones. If your are interested to develop creative mobile applications then you must learn about android OS. Its helpful for you.

    Regards..
    Android Training Institutes in Chennai



    ReplyDelete
  3. Thanks to sharing about android new build system, it is very useful for us.Are you looking for doing courses on android in Chennai? Then you can fill the enquiry form designed by Training in Chennai. We will arrange the best trainer for android course in Real time Manner. We are No 1 Training Center in Chennai.Android Training in Chennai | Oracle Training in chennai

    ReplyDelete
  4. Thanks for your contribution..its useful to increase the quality apps and games in the mobile market...perl training in chennai

    ReplyDelete
  5. Nice Article... Its really Useful for us to know about android new build system..
    Android Training in bangalore

    ReplyDelete
  6. Informative post on Android mobile application development!!! As the usage of iPhones keep on increasing, there is massive demand for best performing Apps and Games for iOS platform. Best IOS Training in Chennai

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Home Mart is a site about Home Improvement, Furniture, Home Appliances and many more.
    Check out the best
    home office desks nz
    coffee table nz
    bookshelves

    ReplyDelete
  9. thanks for sharing this such types of topics.
    AWS Solutions Architect Training in Bangalore
    https://onlineidealab.com/aws-training-in-bangalore/

    ReplyDelete
  10. Taldeen is one of the best plastic manufacturing company in Saudi Arabia. They are manufacturing Handling Solutions Plastic products like Plastic Pallets and plastic crates. Here is the link of the product
    Handling Solutions
    Plastic Pallets
    GrueBleen is one of the Branding and Marketing agency Based in Riyadh- Saudi Arabia. The main functions of GrueBleen is Advertising, Branding, Marketing, Office Branding, Exhibition Management and Digital Marketing. Visit the below link to know more about GrueBleen Creative Club.
    Branding Agency Riyadh
    Marketing Agency Riyadh
    Agriculture Solutions – Taldeen is a plastic manufacturing company in Saudi Arabia. They are manufacturing agricultural plastic products like greenhouse cover and hay cover. Visit the below link to know more details
    Agriculture Solutions
    Greenhouse Cover
    GrueBleen – One of the best social media marketing agency in Riyadh- Saudi Arabia. Visit here for the all service details of GrueBleen.
    Social Media Marketing Agency | Social Media Agency In Saudi Arabia | Social Media Agency In Riyadh | Social Media Agency in Jeddah |

    ReplyDelete
  11. Very nice post here thanks to you for this. I evermore like your blog and such a useful content of these post. Keep doing...
    Pet Cooling Mat

    ReplyDelete
  12. Wow, I can say that this is another great article as expected of this blog. Thanks a million and please keep up the effective work.
    Visit us for online back to back ID cards printing with matt finished.

    ReplyDelete
  13. Thanks for sharing wonderful info, Found your post interesting, can not wait to see more from you. Good luck for upcoming post!!! You can also read more from Social media marketing agency in Winnipeg

    ReplyDelete