[aerogear-dev] Android Studio / Gradle support

Summers Pittman supittma at redhat.com
Wed Apr 2 08:58:13 EDT 2014


Congrats!  I've given some feed back inline with your post.

On 04/01/2014 05:00 PM, Marc Sluiter wrote:
> (next try, sorry again)
>
> Hi all,
>
> some time ago there was already a discussion about using Android Studio / Gradle
> [1], but as far as I can see nothing happened afterwards.
Well lots of stuff happened.  We ended up deciding to do it, and ran 
into the Robolectric problems you described.  Also we were still going 
to have to maintain a maven build to get apk libs working and integrate 
with our various build systems.  Then the maven-android-plugin project 
added aar support so we went with that instead.
>
> So I was curious if I can get the cookbook application running with Android's
> new build system, and want to share what I found out so far:
>
> My first approach was to migrate the cookbook first, and using the library as
> dependency only. But that didn't work out, because the Androd dependencies in
> the pom.xml of the lib could not be found. I really didn't want to install them
> with the maven-android-sdk-deployer, because that's not needed anymore with the
> new build system, it accesses directly the installed Android SDK.
>
> So I migrated the lib first. The first issue was: how do I get the aar into my
> local maven repository? Solution: the Gradle Android Maven plugin [2]. After
> some configuration I could install the lib into my local maven repo with
> "gradlew clean install". Nice.
It is very nice.  mvn clean install should install an aar into your 
local repository as well however.  If it didn't do that can you file a JIRA?
>
> Then I looked how I can run the Robolectric tests in the lib. That seems to be a
> problem, because the Android Gradle plugin team seems to be focused on running
> tests in AVDs or on real devices only [3]. Then I found another Gradle plugin to
> the rescue... at least I thought: the Robolectric team itself maintains the
> Gradle Android Unit Testing plugin [4], which should run JUnit and Robolectric
> tests, but unfortunatly it was broken by the latest Android Gradle plugin
> update... [5]. So I prepared running the tests, but had to comment out the
> plugin for the moment.
>
> So back to the cookbook: here I had to use a workaround now for accessing my
> local maven repo, because the official and easy way is broken in Gradle itself
> atm [6]. But with the workaround I could run the cookbook app on my device with
> "gradle clean installDebug"... finally  (And with the OpenShift Push Server it
> was easy to test the push functionality, great!)
Huzzah!
>
> So my resume of this adventure:
> before that I liked Android Studio very much, I used it for some little private
> fun apps already, and had only few problems. It has features (e.g. product
> flavors) which were more difficult to handle with maven. But I tested only by
> deploying and using the apps on my own devices (shame on me, I know...), so
> missing JUnit/Robolectric support was not an issue for me. And my library
> project was part of the app's project (works nice with Gradle!), so no local
> maven issues.
> But now I think that there is still some work to do with Android Studio and the
> Android Gradle plugin. Some gaps can be filled with 3rd party plugins, but the
> chance that they get broken by new versions of the build system is not low,
> development is very fast.
Yeah.  The fast moving target was a downer for us as well.
>
> One point I forgot: I did not have a look into the Travis stuff, because I don't
> know it yet.
>
> If you are interested in my results, see here:
>
> https://github.com/slintes/aerogear-android/tree/gradle
> https://github.com/slintes/aerogear-android-cookbook/tree/gradle
>
> Kind regards,
>
> Marc
Thanks!
>
>
> [1]
> http://aerogear-dev.1069024.n5.nabble.com/aerogear-dev-Android-Google-s-Gradle-build-tool-and-AAR-td4508.html
> [2] https://github.com/dcendents/android-maven-plugin
> [3] http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Testing
> [4] https://github.com/robolectric/gradle-android-test-plugin
> [5] https://github.com/robolectric/gradle-android-test-plugin/issues/8
> [6] https://code.google.com/p/android/issues/detail?id=63908
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev


-- 
Summers Pittman
>>Phone:404 941 4698
>>Java is my crack.



More information about the aerogear-dev mailing list