Tuesday, November 24, 2015

AWS Device Farm (cloud to farm)

It worked !

I finally tested an android app in cloud. In a farm, more precisely (or a farm in the cloud?)  But it took ages to start up (prepare devices ?).  I wish they will use some sort of a clever virtualization mechanism instead of running real devices which may be the reason for the slowness. Once the initialization phase is done (when the wait is over), it is amazing to see how app is getting tested simultaneously in multiple devices. But the overall slowness killed my appetite to use this as a CI testing tool (which triggers for every commit) rather I would like to use this in regression level. Any way this is still new and, should not judge its capabilities today.

Lets see what google will offer in what they call Cloud test lab


Wednesday, March 04, 2015

Android studio E2E compilation issues

If you use Latest Android studio 1.1.0,

If you notice end to end tests taking far more time to compile than it was before,


You should do the following,

1. Goto run/debug configurations
2. Select Gradle-aware Make step,



3. Edit it and Add only this task,

assembleX86DebugAndroidTest

(Note: Here the "X86" is the build flavour. So this tasks depends on the flavour you have specified in your gradle build)



Voila !

Compilation times reduced to seconds from minutes.

But remember, this only compiles tests.

Tuesday, February 03, 2015

Finally Lollipop !


Finally they released Lollipop to my Moto G !!

Installing..

I wish this might change my whole perception about Android and make me to switch from IOS to android yet again !

Lets see how it goes..

Later : 

Lollipop is simply awesome. I love the material design. I switched, stayed a day, then stated hitting this issue
https://code.google.com/p/android/issues/detail?id=73691

Sadly switched back to IOS until google resolve it in next lollipop update.

Thursday, January 08, 2015

Easy bash alias tool



Chances are high when you happen to use a cool new command while working in linux or mac shell and you are not sure you will remember it next time. Usually those cool commands tend to be messy. How about checking the git log with the graph and branch names.


git log --graph --oneline --decorate

Now this may be alright with many people. But I usually forget/hate long commands (no matter how awesome they are) and what I usually end up doing is  setting up an alias.
You can do that in two sets.

  1. Add "alias gl=git log --graph --oneline --decorate"  to your ~/.bash_profile.
  2. Open a new terminal or refresh the current terminal with "source ~/.bash_profile"

Now thats a pain. Specially if you happen to find "cool commands" so often and you just have to stop what you do and do that two steps every time when you need to add an alias. And remember, setting up aliases can be highly addictive. You basically end up creating whole new your DSL sort of thing.

So I thought how nice it would be if I can setup an alias using a single command. The goal is to create a command which does both steps for you. When you in a terminal session, when you find out a cool new long command, you just call our new tool, it will add the new alias  to .bash_profile and reset the current session all at once without we have to do anything, making our new command available instantly.

Introducing the command aset.

aset ALIAS-NAME COMMAND // command should be in double quotes


If my long cool command to see git log with graph is this >> git log --graph --oneline --decorate

I will set an alias to that exact command as gl

aset gl "git log --graph --oneline --decorate"

Thats it. The new command gl should be available right after we press enter.

To get aset from follow instructions in my github,

https://github.com/asangamanage/productivity/blob/master/easy-alias.txt

Or simple run this command in your shell. (tested in OS X)

echo "function aset() { echo "\"alias \$1="'\$2'"\"" >> ~/.bash_profile;source ~/.bash_profile;}" >> ~/.bash_profile; source ~/.bash_profile

Some aliases to start with. Please note that its fun and easy to add more and more.

aset gl "git log --graph --all --oneline --decorate"
aset gh "git checkout"
aset gc "git commit"
aset gp "git push"
aset gu "git pull"
aset gm "git merge"
aset gs "git status"

Happy aliasing !!




Saturday, January 03, 2015

How to manage multiple JDK versions in Yosemite



See all installed java versions,  (Please note the capital V, simple v will be used later on for different purpose)
 /usr/libexec/java_home -V  
Outputs..
 Matching Java Virtual Machines (4):  
   1.8.0_25, x86_64:  "Java SE 8"  /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home  
   1.7.0_71, x86_64:  "Java SE 7"  /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home  
   1.6.0_65-b14-466.1, x86_64:  "Java SE 6"  /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  
   1.6.0_65-b14-466.1, i386:  "Java SE 6"  /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  
Now you know whats available. All you need to do now is change your ~/.bash_profile to set JAVA_HOME. Before we do so, lets see how we can use /usr/libexec/java_home tool to retrieve JAVA_HOME paths of each versions.

Following command gives JAVA_HOME path of a given java version installed.
 /usr/libexec/java_home -v  
v1.8
  asanga@localhost:$ /usr/libexec/java_home -v 1.8  
 /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home  
v1.7
  asanga@localhost:$ /usr/libexec/java_home -v 1.7  
 /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home  
Now, lets add that trick to our ~/.bash_profile.
 export JAVA_HOME=`/usr/libexec/java_home -v 1.8`  
 #export JAVA_HOME=`/usr/libexec/java_home -v 1.7`  
 #export JAVA_HOME=`/usr/libexec/java_home -v 1.6`  
Now you can uncomment the version you need when you need.

Monday, December 08, 2014

Android Studio version 1.0.0 Released

Much waited Android studio V1 is out. Well,  if you are android dev, and do android as your day job, you should not be excited about this release much because , we know how quick is google when it comes to AS releases.

I am happy now the AS is out of BETA. Now I expect google to be responsible as not to ship buggy versions anymore. Thanks Google for taking AS out from Beta.

While this post is about AS 1 release, this is particularly about a FIX you need to do to your Gradle builds to get the new version up and running. If you use following properites in your build file, you might have a tough time figuring out why your builds are failing with this new shiny production ready AS.

OK, lets cut to the chase.

If you get one of these errors,


  1. Gradle DSL method not found: 'runProguard()'
  2. Gradle DSL method not found: 'zipAlign()'
  3. Gradle DSL method not found: 'jniDebugBuild()'
  4. Gradle DSL method not found: 'renderscriptDebug()'

You should change those property names to these new ones,

  1. BuildType.runProguard  ->  minifyEnabled
  2. BuildType.zipAlign  -> zipAlignEnabled
  3. BuildType.jniDebugBuild  -> jniDebuggable
  4. BuildType.renderscriptDebug  -> renderscriptDebuggable


Find more changes below,

http://tools.android.com/tech-docs/new-build-system

Lesson learned,

Don't update AS, without looking at release notes as new releases may not be backward compatible.