Profile

Cover photo
Erik Hellman
Works at Bontouch
Attended Blekinge Institute of Technology
Lives in Malmö, Sweden
1,167 followers|604,636 views
AboutPostsCollectionsPhotosVideos

Stream

Erik Hellman

Shared publicly  - 
 
I made a watch face for Android Wear. Unless you can read Swedish, this is probably not very special. :)

#andoridwear   #android   #swedishhumor  
Vi svenskar gillar att säga "klockrent!" så jag tyckte vi behövde en klocka...
3
1
Stefan Hoth's profile photo
Add a comment...

Erik Hellman

Shared publicly  - 
 
State of testing on Android in 2015.
Matthias Käppler originally shared:
 
My verdict for unit testing on Android: it's 2015, and it's still somewhat broken.

Perhaps not as broken as it used to be, but still broken in some really fundamental ways.

We've been using Robolectric 1 for a very long time in the SoundCloud app and built up a substantial test suite (cloc counts about 73K lines of test code), but building something that mission critical on legacy software is of course a ticking time bomb.

After all the recent fuss about improvements in Android unit testing, I spent quite some time evaluating the different approaches to select the one that would offer us the greatest benefit with the least amount of friction (side note: it's 2015--why does unit testing require time to make it work? It should be as straight forward as drinking a cup of coffee.) I have to say I left disappointed; some things are broken by design, others are just broken. Brief summary:

Variation 1: Running unit tests on a connected device
The obvious benefit here is one of confidence: you are instrumenting your code against an actual system image, with the same VM that will actually run your code in production. It's the real deal. In the past, this approach wasn't exactly a great solution for numerous reasons (poor emulator performance, impossible to use mocking libraries, no JUnit 4 support to name the biggest ones.)
This has gotten better: we have a JUnit 4 runner now [0], we have DexMaker (a bytecode backend for Dalvik) [1], and we have Genymotion, but one of the major problems still exists: the platform JAR is full of final classes and methods, so you either have to write your tests to take that into account, or move your code as far away from the platform as possible; which is likely a good idea anyway [2], but induces the cost of introducing abstractions that might purely exist for testability.

Variation 2a: Running unit tests on the JVM (not using Robolectric)
With the arrival of "experimental unit testing support" (now not experimental anymore), we can now run tests from src/test/java using ordinary test runners. Since it's an ordinary Java unit test, you can use ordinary test setups and libraries, too. Rejoice! However, this approach still has several drawbacks.
Although a Gradle task has been introduced that strips the platform JAR of all finals and method bodies, as soon as your test subject is somehow entangled with the platform, like when using Intents or Bundles, your test will likely fail, since all these classes are stubbed out. Since Intent or Bundle are foundational platform types, they typically don't appear as collaborators in constructors, so you either have to come up with awkward indirections ("intent providers") or, again, move your code as far away from the platform as possible (again, see [2]) You will also likely end up wiring a lot of mocks in your tests, making your tests hard to read and understand (after all, that's one reason why Robolectric was initially created)
A final annoyance: why on Earth am I not able to see both unit tests and acceptance tests at the same time? Due to some idiosyncratic behavior in either AS or Gradle's Android plugin, only one Gradle source set containing tests can be active at once, as chosen by the "test artifact" setting in your build flavors. So unit tests are piggy backed on a system that it wasn't really built for, and it means that any refactorings you apply to one source set will not apply to the other source set, which is just asking for trouble. I hope this is only temporary and will get addressed with future versions of the AS (I assume it's a shortcoming of AS.)

Variation 2b: Running unit tests on the JVM (using Robolectric)
After we tried so hard to move away from Robolectric 1, we closed the circle by opting for... Robolectric 3. At SoundCloud we decided it was the most preferable solution of the three. It comes with all the benefits of running a normal JUnit test, but doesn't penalize you for writing tests for classes that use things like Bundles directly. Unfortunately (--or fortunately?), the higher you go up in the layers, the more difficult it is (still) to unit test something, which is probably a signal that even with a powerful tool like Robolectric, you should test code that is close to the UI sparingly (if at all), and focus on testing presentation /logic/, business rules, and anything beneath. For instance, Robolectric hasn't quite figured out timing yet, so things like animations steered by a presenter might fail. [3] Overall it's a huge step forward from the initial release though, and comes nicely modularized. By combining test rules and base classes for your tests, you can also keep much of the setup boiler plate out of your actual test cases, so that you don't couple yourself too much to any RL specifics.

[0] http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html
[1] https://github.com/crittercism/dexmaker
[2] https://blog.8thlight.com/uncle-bob/2014/05/11/FrameworkBound.html
[3] https://github.com/robolectric/robolectric/issues/1879
2
2
Android Resources's profile photoGabor Orosz's profile photo
Add a comment...

Erik Hellman

Shared publicly  - 
 
If you live in Liverpool and you're a interested in the stuff that was announced at Google IO, then you should really attend this! :)
 
Do you want to know more about what happened this year at #io15?

Join Appsolutely Liverpool tomorrow to explore what the new announcements have in store for us and also discover best practices.

#GDE  +Paul Blundell will lead a discussion and present his experiences from attending this years Google I/O and also cover the brand new Android M APIs. 

Register here: https://www.eventbrite.co.uk/e/appsolutely-liverpool-post-io-discussions-tickets-16989841072
2 comments on original post
2
Add a comment...

Erik Hellman

Shared publicly  - 
 
I'll be speaking at #øredev this year. Don't miss my awesome talk about #android. :-)

#gde #techtalks 
9
5
Google Developers Experts's profile photoАндрей Рогачёв's profile photo
Add a comment...

Erik Hellman

Shared publicly  - 
 
I'm a Google Developer Expert for #Android, and if you don't know what that is you should watch this video: https://www.youtube.com/watch?v=37GpI_s8q-8

#gde
21
3
Leonel Mendez's profile photoVladimir Bjelakovic's profile photoGabor Orosz's profile photoStephen Fluin's profile photo
4 comments
 
Hello friend! How is it going? 
I would like to became a google expert I sent my application but I dont have answer yet. Can you give me some advice? Greetings from Mexico 
Add a comment...

Erik Hellman

Shared publicly  - 
 
I like this description of me. :)
 
+Erik Hellman is an Android GDE from Sweden He is the author of 'Android Programming: Pushing the limits'.    Erik is very good with beginner android developers he likes to take the time to answer even the smallest questions from beginners.  

If you find him ask him what surströmming is.   After you have asked him any Android related questions you may have. 

#io15   #GDE  
View original post
13
Raveesh Bhalla's profile photoErik Hellman's profile photoLinda Lawton's profile photo
3 comments
 
correction its rotten fish.    +Erik Hellman  i am never coming to visit you.
Add a comment...

Erik Hellman

Shared publicly  - 
 
Yeah, G+ is totally dead... ;)

#googleplus  
12
Add a comment...
Have him in circles
1,167 people
Kevin Barry's profile photo
David González's profile photo
丁志虎's profile photo
call cost koutech's profile photo
yale lam's profile photo
Andrej Petef's profile photo
Kolade Kehinde's profile photo
Eren Bekar's profile photo
Alejandro Berdinelli's profile photo

Erik Hellman

Shared publicly  - 
 
 
There are many ways, not all well-documented, to get crashes because of a bad handling of .so files in Android apps.

With gradle and maven central, that's really too easy to include a .aar that adds .so files inside your app. You may even not notice it before you get the first crash reports on some brand new or older devices!

So here is what I think any Android dev should know about .so files:
http://ph0b.com/android-abis-and-so-files/

#android   #gde   #article  
In its early days, the Android OS was pretty much supporting only one CPU architecture: ARMv5. Do you know how many it does support now? … 7! Seven distinct CPU-architectures are currently supported by the Android OS: ARMv5, ARMv7 (since 2010), x86 (2011), MIPS (2012), ARMv8, MIPS64 and x86_64 ...
View original post
2
Add a comment...

Erik Hellman

Shared publicly  - 
 
Any cloud experts that can help me with this problem? 
1
Michal Harakal's profile photo
 
Don't ask, run...
Add a comment...

Erik Hellman

Shared publicly  - 
 
Sweden National Day today.

Everybody has to eat surströmming (http://en.wikipedia.org/wiki/Surstr%C3%B6mming)! 
Sweden National Day 2015 #GoogleDoodle
1
Linda Lawton's profile photo
 
Wtf. Sweden must smell nasty today 
Add a comment...

Erik Hellman

Shared publicly  - 
 
Important points for the M preview!
 
I know the permission UIs in the M-preview are not final and there will be a lot of improvements. Here are few things I'd like to see:

Allow developers explain why they need the permission. The best place to do that would be the app's manifest. Add an attribute to the uses-permission tag to make is something like this:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
        android:explanation="Needed to enable navigation feature"/>

This could then be displayed on the attached screen to help users understand why the permission is there.

Add explanation what the permissions actually mean
While some of them are self explanatory not all of them are very very clear. For example Phone. What does it mean? Can the app make phone calls? Or just read the phone identity? 

This could be shown in the same UI to help user understand what they're actually granting to the app.



.. Anyways, Google probably has all this covered already in their internal builds. Just wanted to point them out anyways.. just in case.
35 comments on original post
9
1
Mike Wolfson's profile photoNacho Coloma's profile photoFenn Cheng's profile photo
2 comments
 
+Mike Wolfson i18n could be a problem with that.
Add a comment...

Erik Hellman

Shared publicly  - 
8
Jonas Petersson's profile photoViljo Viitanen's profile photo
2 comments
 
+Jonas Petersson my first thought too...
Add a comment...
Erik's Collections
People
Have him in circles
1,167 people
Kevin Barry's profile photo
David González's profile photo
丁志虎's profile photo
call cost koutech's profile photo
yale lam's profile photo
Andrej Petef's profile photo
Kolade Kehinde's profile photo
Eren Bekar's profile photo
Alejandro Berdinelli's profile photo
Education
  • Blekinge Institute of Technology
Basic Information
Gender
Male
Birthday
February 6
Story
Tagline
Awesome software developer with Android focus.
Introduction
Inventing the next cool thing for your smartphone.
Bragging rights
Author of Android Programming: Pushing the Limits (www.wiley.com/go/ptl/androidprogramming).
Work
Occupation
Senior Android Engineer
Skills
Software Development, Android, HTML5, Java, Python and much much more.
Employment
  • Bontouch
    Technology Evangelist, 2015 - present
  • Spotify LTD
    Senior Android Engineer, 2013 - 2015
  • Factor10
    Consultant, 2013 - 2013
    Senior consultant
  • Sony Mobile Communications
    Research Manager, 2010 - 2013
  • Sony Ericsson Mobile Communications
    Senior Software Architect, 2010
  • Ericsson
  • IBS JavaSolutions
  • Blekinge Institute of Technology
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Malmö, Sweden
Previously
Borlänge, Sweden - Ronneby - Karlskrona - Gothenburg - Trollhättan - Riyad, Saudi Arabia
Contact Information
Work
Phone
+46-705-777477
Email
Apps with Google+ Sign-in
  • Never Alone
  • RETRY
  • Out There
  • One finger death punch
  • XCOM®:Enemy Within
  • Sky Force 2014
  • Monument Valley
  • LIMBO
  • Angry Birds Under Pigstruction
  • République
  • Star Wars™:KOTOR
  • Table Top Racing
  • The Inner World
  • Boom Beach