
Android platform engineer on application architecture - EddieRingle
https://plus.google.com/105051985738280261832/posts/FXCCYxepsDU
======
Benjamin_Dobell
Unfortunately, the contents of this post are no surprise to any seasoned
Android developer. It's very clear the Android engineers haven't given a lot
of thought to how applications are to be developed.

I'm all for them not enforcing one methodology over another. However, in order
to build an Android application (following whatever pattern) we do need core
building blocks that have been well thought through on how they will be used.

In general performing Async tasks (in particular networking) is excruciatingly
convoluted on Android - well, at least to get it right. _Many_ inexperienced
Android developers simply get this wrong, and quite frankly I can't blame
them. Such a common task should be trivial to perform and not require hours of
background reading.

The issue largely comes down to the fact the "system framework" has been
designed to be simple (supposedly[1]) for system framework maintainers, and
not developers writing applications. Destroying and recreating activities (so
you can load different resources) may be simpler from AOSP's perspective, but
it's not at all logical from the perspective of an application. Sure, there
are several ways to work around this, but they're all stupidly convoluted.

 _Frameworks should be written for consumers, not maintainers._

[1] Okay, the system frameworks definitely aren't actually well designed /
simple to work with for framework maintainers either, that was just the
(missed) goal. If you want to see world's worst state machine (a stupid amount
of booleans), check-out: [http://stackoverflow.com/questions/17847775/nested-
fragments...](http://stackoverflow.com/questions/17847775/nested-fragments-
illegalstateexception-can-not-perform-this-action-after-onsa)

~~~
Aaargh20318
Not only didn't they give a lot of thought on how apps are to be developed,
they made a bunch of really shortsighted design choices that continue to harm
Android as a platform today.

First is the stupidity of Activities. The basic idea was that 1 screen = 1
activity and we can remove all non-active activities from memory and restart
them as needed. This was clearly designed with an eye on memory constrained
systems. Nowadays even the cheapest phones have shitloads of RAM but we're
still stuck with this retarded model. Worse, now we have support for tablets
and phones with big screens the 1 activity per screen no longer makes any
sense anymore either.

Second, the decision to go with Java as a language. After they make us jump
through ridiculous hoops to fit our applications into their stupid activity
model just to save RAM, they go waste it by chosing a GC'd language, combined
with the performance hit you take for the VM this this has really hurt Android
app performance. In return we get an OS that can run in multiple CPU
architectures, unfortunately no one runs it onanything other than ARM. The
0.01% of non-ARM devices can't run half the software anyway because they
included ARM JNI components to work around the slowness of the VM.

But, I hear you say, you can supply JNI binaries for multiple architectures.
Sure you can, if you can fit them in your APK, which you can't because your
APK is limited to 50MB because it has to be downloaded to a temp partition
before installing. This brings us to the thirds major fuckup: the file system
on Android, or specifically the fact that there are several filesystems
instead of just the one. But hey, at least now we get to support removable
storage, which is both a PITA for developers, extremely confusing for end-
users (why can't I install this app when I have gigabytes of free space on my
SD card ?) and after all that trouble hardly any phone has removable storage
anymore.

This seems to be the big problem with Android's development: a complete lack
of vision by Google. They never designed for tomorrows hardware, instead they
designed for last years hardware. Android is an OS built around hardware
limitations that no longer existed by the time it gained momentum. It's like
they were completely surprised by the speed at which mobile hardware evolved.

~~~
konschubert
> First is the stupidity of Activities. The basic idea was that 1 screen = 1
> activity and we can remove all non-active activities from memory and restart
> them as needed. This was clearly designed with an eye on memory constrained
> systems. Nowadays even the cheapest phones have shitloads of RAM but we're
> still stuck with this retarded model. Worse, now we have support for tablets
> and phones with big screens the 1 activity per screen no longer makes any
> sense anymore either.

Shouldn't fragments solve this?[0]

[0]
[https://developer.android.com/guide/components/fragments.htm...](https://developer.android.com/guide/components/fragments.html)

~~~
thecupisblue
Uh, fragments introduced just more of the same problems. A fragment in an
activity has an insane, confusing lifecycle, then if you nest them, you
basically summon Cthulhu. The more experienced part of the Android dev
community is slowly transitioning into using views instead of fragments.

------
twotavol
Eschewing the traditional application architecture has made for both a
terrible development experience and poor quality applications in general. The
application lifecycle is convoluted with even the Android developers joking
about how confusing it is. Everything about the model has made it far more
difficult to port existing software to, and native development for me
personally has been an absolute nightmare. No clean exit strategy for
applications, half the methods in the lifecycle don't even get called, etc. I
can't imagine the completely naive and oblivious thought process that led to
the mess they created. Good thing Android is backed by Google though, so no
matter how terrible it is it'll still be popular.

~~~
lanestp
I agree. Android architecture is a mess. Activity life cycling is actually
impossible. There are certain actions the OS takes that will cause crashes no
matter how well architected the app is.

My main quibble with Android is that since everything is tied to the
activities it is impossible to build an MVC style app. You are better off
using the NDK or an engine. Then you can build your software correctly.

~~~
EddieRingle
Do you mind expanding on some of your statements? Especially:

> Activity life cycling is actually impossible. There are certain actions the
> OS takes that will cause crashes no matter how well architected the app is.

~~~
lanestp
I work on a very popular app in Latin America. That means we get to experience
every single edge case in the eco system. My favorite quirk has been that for
some reason I will never understand when an app goes into a full screen ad it
can make your main activity eligible for GC. That means that you don't get any
of your Activity life cycle events. Just a lone finalize and your app is gone.
Then when the video ad is done you get a truly spectacular crash!

Sadly, I have a half dozen different ways activities have found to explode
themselves. It makes me sad!

~~~
EddieRingle
Sounds like the video ad is a new activity? Since it's full screen, your main
activity is no longer visible so you should be seeing onPause and onStop fire.
Are you saying you don't see them?

Also, I'd imagine video ads are also quite memory intensive, so if a low-RAM
device is playing one I wouldn't be surprised if Android has to kill some
processes (like your activity that was sent to the background) to make space.

Perhaps you should look into what these video ads are doing and what sort of
resources they eat up?

------
cnbuff410
One thing platform engineer should do is to rotate into app engineer role and
experience it for a couple month at least, without doing it you don't really
understand all the pains the app engineers are suffering due to platform
design. At very least you can make your doc so much better by knowing which
part you absolutely want to cover in details.

This is especially true for Android platform team, to be honest.

~~~
spriggan3
What a platform engineer needs to do is to listen user's feedback early and
often in order to improve the API. An API is a product,and like every products
there should be usability concerns. I wouldn't say Android SDK is bad, it's
just so convoluted it doesn't feel like it was written in this century.

It's like someone wanted to impose something regardless of its usability, a
lot of design decisions seem to have been taken unilaterally because of one
engineer's ego.

------
shruubi
After developing a few Android apps as an agency dev, we settled on a common
structure that helped keep our code relatively clean.

Each activity would have an associated fragment, the idea was that the
activity would be responsible for loading the fragment as the current view and
other lifecycle functions as well as being the entry-point for any external
data-loading (through creating and calling of services).

The fragment would initiate with a reference to the parent activity as a
context, and would be responsible for view-centric things like displaying
content and adding event handlers, which would more often than not use the
context reference to call some remote API.

I suppose you could think of it in terms of Model/Controller/View-Controller
but I'm sure there is a more correct model for thinking about it (and it
probably is more straight MVC anyways).

The problem I've found with Android is that Google has created almost it's own
language when it comes to Android app architecture, which creates a lot of
confusion, especially for developers who just assume that all frameworks use
the MVC concept (laugh if you will, but this is a thing).

Even though google is quite behind when it comes to the app market, I think
there is still time for them to come out with a new set of documentation which
outlines the "correct" (the "Google-blessed" one at least) structure for
Android apps so that we as a development community can start moving away from
the "everything-and-the-kitchen-sink goes in the current activity" style of
Android development.

~~~
jc4p
What you described sounds a lot like what I used to do for years. It works
fairly well, and you can tack a headless Fragment onto it for things that you
don't want directly connected to an activty's lifecycle (rotating the screen
mid user sign-up shouldn't restart the HTTP call, etc).

This works well, and I'm at the point where I develop it without thought while
creating new apps, but I've been playing with a less constrained DI flow
instead using Dagger 2.

The more business logic and multiple copies of shared UI elements in different
Fragments are directly connected to their parent Activity, the harder it is to
re-arrange and re-use them. I've been working on migrating all core elements
of our application into a shared library project, and that would've been
impossible with a closely tied codebase.

~~~
bschwindHN
> rotating the screen mid user sign-up shouldn't restart the HTTP call, etc

This was the very first thing I struggled with when making my first (and to be
honest, only) Android app. I was making an HTTP call in a background thread
and when the screen rotated, the app crashed. Making this kind of basic
functionality harder to program is such a big turn-off for the platform, and
seriously lowers my confidence in the correctness of what I've written.

I ended up writing this gross code ([https://github.com/bschwind/skritter-
android/commit/6fdffab1...](https://github.com/bschwind/skritter-
android/commit/6fdffab111629cb79d732789b83a088e9c335eea)). That's probably not
the recommended way to solve it now, or maybe it is. I don't know because
everyone seems to have their own special solution to the problem, and we're
lacking solid, idiomatic solutions to basic problems an app developer faces.

For the small Android work I do now, I just stay in my own little NDK world.

Edit: It also seems I was pretty frustrated with the android API at the time,
lots of colorful print statements :)

~~~
jc4p
I used to use AsyncTask way more, I now stick to other ways to doing
background processing. What you have is pretty close to what I described as a
"headless fragment", it's a pretty common (but ugly, imo) paradigm, from the
looks of it you either made something similar to or followed this:
[http://www.androiddesignpatterns.com/2013/04/retaining-
objec...](http://www.androiddesignpatterns.com/2013/04/retaining-objects-
across-config-changes.html)

Nowadays I've pretty much drunk the RxJava kool-aid. For this kind of thing, I
would make the HTTP method exist inside of an Observable which would be
observed on a shared single instance Looper provided via Dagger.

~~~
bschwindHN
Yep! I think that's the exact article I settled on after running into that
problem. It's been 2.5 years since I wrote that code and I haven't done any
significant Android programming since then. Next time I do, I"ll give RxJava a
try.

------
jwatte
I worked with Dianne fifteen years ago, and she was good. However, hearing
from others who were involved in early Android, and then left in disgust, the
designers who set out the initial form did boot have extensive application
framework/developer experience, and we're still hiring to this day because of
it.

Let's say it all together: Implementation inheritance is a mistake, and
interface based design is a clearer option.

~~~
thrownaway2424
It's not just that. Hackborn spent many years denying that Android was janky
as fuck, or making excuses for it (e.g.
[https://plus.sandbox.google.com/105051985738280261832/posts/...](https://plus.sandbox.google.com/105051985738280261832/posts/2FXDCz8x93s)).

~~~
RomainGuy
You must be mistaking me with someone else.

~~~
thrownaway2424
Deleted, then. Perhaps I have conflated the memory of being at javaone and
being told all about the wonders of javafx, and the contemporaneous wonders of
"filthy rich clients".

------
HillaryBriss
This makes my head spin.

Plenty of examples on developer.android.com use Activities, Services,
BroadcastReceivers for things that go beyond what Dianne Hackborn is
recommending here.

It's like the Android SDK team want to have their cake and eat it too:

"We've built a tremendously powerful and useful SDK. It really helps you build
great apps quickly and easily."

vs.

"Oh, and, by the way, be careful not to misuse our main components. They were
never designed to help you build great apps quickly and easily."

~~~
saturn_vk
Well, d.android.com exists to showcase the core apis. They can't possibly show
you how to create an app with 3rd party components on top of a single
activity. Just take the bear necessities from there add your own stuff on top.

~~~
HillaryBriss
I guess I've been reading that documentation from the wrong perspective. I
thought they were trying to show me the right way, or at least, a good way, to
create apps and add features to them.

------
zzalpha
The fact that an Android platform engineer doesn't know of design patterns
beyond MVC, and only knows that vaguely by reputation, explains why it's so
difficult to build well designed apps for Android.

Yes, technically the platform APIs don't "care" about what's going on in an
app. But when the APIs are designed in such a way as to (inadvertantly) work
against MVC or other design patterns, they make developer lives more
difficult. And you can expect that to happen if your platform engineers aren't
familiar with these concepts.

~~~
userbinator
Actually I'd attribute the difficulty to the culture of "Java-ism" that
emphasises huge, complex, design-pattern-filled "extensible" architectures
which happen to be extensible only in very specific ways.

I wanted to take up casual writing of Android apps as a hobby, mainly because
I think the little portable computer I keep in my pocket could become so much
more useful, but the unusual API combined with the complexity and general
baroqueness of the architecture was a big turn-off. I don't get the whole
"design patterns" thing either, but I do have extensive experience with
writing Win32 apps, and a little bit of X (which is not all that different.)

~~~
aphexairlines
26min into the 2014 Google I/O Android fireside chat:
[https://youtu.be/K3meJyiYWFw?t=26m](https://youtu.be/K3meJyiYWFw?t=26m)

Q: So I was wondering if you guys at any point considered the support -- the
official support -- of the Scala programming language. I'm asking this
question especially now that we all saw that Apple released Swift after 4
years of work. And I think that Swift allows for things for iOS developers
that we can't do in Java with the Android SDK. So my question was: have you
ever thought about it before -- the release of Swift? Have you thought about
it after that? Is there any plan?

Android answer 1: Well, so, I like Cocoa, but Objective-C is based on C, which
is 40 years old, so I think Apple sort of had to, like, update it a bit. Umm,
so, yeah [laugh], I don't know. Scala -- I don't know. Anyone want to take
that? [Android team laughs]

Android answer 2: [loudly] No. [room laughs, claps] Alright, seriously, it's
-- Java is the programming language for Android. I don't really think there's
a lot of benefit to -- the entire framework is built around the Java
programming language and I don't really -- I don't think there's much benefit
for us to try to support another whole -- another different language.

Person from answer 1: What about Swift? [room laughs]

Person from answer 2: [jokingly] I'll think about it.

Person from answer 1: [mockingly] It's got optional semi-colons.

Person from answer 2: You have the NDK so you can throw something there. But
the NDK -- it doesn't have access to the framework, and that's kind of the
challenge. If you want to do a different language, if you want to have it as a
first-class language equivalent to the current framework you've got to have
either a whole new framework or some bindings to it, which is going to make it
a really bad experience because it's going to be Java and this other language.

Q: I want to work with Scala because Scala is compiled to the JVM, so it can
run on Android. So there are currently ways to do that -- to work with Scala
-- but it's using third-party libraries. So you have classes -- that's what I
meant by people to wrap their Java classes, but then it becomes tricky to
integrate that cleanly with Android Studio. That also evolves quickly. I'm not
sure if it's as complicated as creating a whole new language like Apple did,
but my question was just if you guys were considering any...

Android answer 3: From the tool perspective, probably later this year or early
next year, there are some changes going on inside Gradle right now that will
make things easier to you to just have a module that's originally written in
Scala that you compile down to bytecode and then we can just dex that and
package that with your application. But it's not going to help you access the
activity API through Scala code. It would be -- if you have some code that --
your business logic or whatever that you want to write in Scala because it's
easier for you, you should be able to do that. Because as you said, it's
compatible. It just generates regular bytecode and then just dexing it. But
that's very different from saying "you can code Android in Java" where you
have access to all the framework APIs.

~~~
christop
I gave up on watching those Android Fireside chat sessions because of the
horrible jokey way in which so many valid concerns end up getting dismissed,
every time.

~~~
HillaryBriss
It's been interesting to see the emergence of the Android Developer-Advocate-
Comedian in Fireside chats and at Google I/O sessions.

Maybe some of these folks are bored with their jobs, or just tired of trying
to do the impossible: convince the developer community that the Android SDK is
a great and well designed thing that makes creating great, robust, secure apps
easier and faster.

"We know we can't give them world-class, visionary, insanely great
engineering, but we can try to give them something entertaining."

Bread and circuses ...

------
vowelless
Disclaimer: I am not an Android developer.

I cannot seem to reconcile these two statements:

> Should you use MVC? Or MVP? Or MVVM? I have no idea. Heck, I only know about
> MVC from school and had to do a Google search to find other options to put
> here.

And

> In Android, however, we explicitly decided we were not going to have a
> main() function, because we needed to give the platform more control over
> how an app runs.

So this person claims to not know or care about design patterns; but then
explicitly enforcing a design pattern?

She does say:

> Android could feel like it has strong opinions on how apps should be
> written. With its Java language APIs and fairly high-level concepts, it can
> look like a typical application framework that is there to say how
> applications should be doing their work. But for the most part, it is not.

But after reading through the post, it does seem like a particular set of
design patterns is being propagated.

~~~
EddieRingle
Seems many people are missing the overall point of the post: The APIs Android
provides that are listed here are intended to be used as the glue between your
application and the rest of the system. However you want to build your
application from that point on is up to you.

In particular, Android Activities aren't simply a main() function because they
are designed from a multitasking standpoint; users are going to be going in
and out of apps, changing the state of the device (such as rotating the
device), etc. In other application environments, you might register callbacks
to fire when the window is hidden or gets resized. In Android those callbacks
already exist and are set in stone to encourage apps to behave as a good
citizen on a potentially resource-constrained mobile device. But as the post
details, you don't have to do anything beyond properly managing heavy
resources (like camera access) and saving and restoring state at the
appropriate points if you don't want to.

------
kabdib
You need only look as far as the large collection of flags involving the
Intent object to realize how badly things went wrong.

~~~
EddieRingle
Most Android developers I know (and even some iOS developers) consider the
Intent system one of Android's diamonds in the rough.

Could you perhaps explain how you would've designed it?

~~~
Benjamin_Dobell
The _concept_ may be a diamond in the rough i.e. co-operative multi-tasking.
The implementation, not so much.

~~~
georgemcbay
Speaking as someone who has been writing Android software for like 4 years now
as my job (but who has been in the industry for much longer than that, as a 42
year old who has programmed in just about every major environment), I agree
with what you wrote here.

Intents are great in concept and they work out well for users, but the
interface/API for using them to do anything can quickly become painful if you
go even a step off the beaten path of "perform this operation with these
parameters".

A common recurring theme with Android (and this applies to all the major bits
-- Activities, Fragments, Services, etc) is that you'll easily hang yourself
if you don't have a really clear picture of how they actually work but you
attempt to use them. Android almost completely fails, IMO, when it comes to
the concept of "keep the easy things easy". There's a huge upfront cost to
understanding the major components before you can start really using them at
all safely, in my experience. As a bare minimum, if you don't have an intimate
understanding of the Activity and Fragment lifecycles and a full understanding
of what needs to be on the UI thread when (and when different callbacks from
the OS are/aren't on the UI thread) you are likely to create a terrible mess
of an app that kinda sorta works on most devices, usually, but is broken in
some fundamental ways you aren't aware of.

I don't personally know any day to day Android developers who haven't spent a
considerable amount of time in the AOSP code trying to figure out exactly how
some of these systems work because failing to understand them internally
combined with lack of any sort of clear direction from the platform team
(extremely open case of there being more than one way to do anything, which
makes authoritative answers to the question "How should I do this?" nearly
impossible without a long list of caveats) is the path to writing Android code
which mostly works but has some fundamental mismatches with the operating
system and becomes a complete mess to maintain.

------
zebob123
The great "Advocating Against Android Fragments" post on the Square Corner
blog by Pierre-Yves Ricau highlights how horrible the Android lifecycle is.

[https://corner.squareup.com/2014/10/advocating-against-
andro...](https://corner.squareup.com/2014/10/advocating-against-android-
fragments.html)

Also, if you are doing any substantial Android development, you are bound to
run into many issues (say, for instance, it's horrible soft keyboard
management system). Hackborn can be found on many of these issues trashing
developers asking those questions.

[https://groups.google.com/forum/#!topic/android-
platform/Fyj...](https://groups.google.com/forum/#!topic/android-
platform/FyjybyM0wGA)

Non productive vitriol is the norm for this person.

------
grendozy
Android noob here. I've been teaching myself Android programming for the past
couple of months and I've found it overall a messy and unpleasant experience
for the reasons many of you have already mentioned. So much, in fact, that I'm
looking for alternatives.

So what's the best option?

Kivy? Python is slow, adoption seems non-existent, not suitable for every kind
of app

Cordova? Web apps are slow, JavaScript sucks big time

Qt? Google discourages use of the NDK for developing apps, can't figure out
anything from their crappy website

Xamarin? C# doesn't look like a significant step up from Java, from Microsoft

Delphi? Proprietary, Windows-only and costly

Clojure/Kotlin/Scala? It seems you need to be a master Android developer to
use them, still doesn't get you out of the horrible Android architecture.

~~~
virmundi
Android is a messy process. Since you've effectively implied that you're
excluding all of the options, you only have message Android.

Web apps don't suck that much as long as each screen does one thing well.
Xamarin is for getting a slightly more elegant language (since Java 1.8 isn't
supported) into the mix while providing a reasonable cross-system platform.
Clojure/Kotlin/Scala do require you to master Android first because they are
built on top of it. Each provides is own abstraction, even if it's just a
language.

In the end it's about trade offs and acceptance. Raw Android is like working
in a better assembly. It's got decade's old abstractions. It's powerful, but
annoying. For everything else, there's the complexity of working with the
various abstractions over a system that does not want to be abstracted.

------
petra
If this is so terrible, why isn't there some Java framework on top of this
that's designed to make sense for developers?

~~~
jmfayard
They do exist.

Check out rxjava from netflix, dagger and butterknife and okhttp and retrofit
and picasso (and and....) from square, MVP libraries, kotlin and anko from
jetbrains

What is truly holding back many developers is the above cargo cult that the
path mentionned in android.developer.com is always the right one.

There have been some harsh comments on Dianne Hackborn, but I find that she is
actually doing us a great service here by dissiping this myth. I find she does
a great job at explaining what is the scope they really care about, and the
one where you are free to discover better alternative that do not have the
"Google" label on it.

~~~
kodroid
I agree with your last two statements, but the idea the RxJava and Dagger make
things _easier_ to understand for developers (I'm inferring this relates more
to newcomers to Android as they are the once which have a hard time grokking
this stuff) is a joke. RxJava and Dagger only increase ramp up time and the
amount of stuff to learn, regardless of how useful they are. If someone came
to me confused and I pointed them in that direction, Im sure they would get
lost in the woods somewhere and Id never see them again.

~~~
jmfayard
Fair point. They make things simpler, not easier

------
hidro
Rails is built on top of Ruby language, designed to be opinionated, following
MVC. You like it, you use it. You don't like it, try another framework.

Using the same analogy, Android is build on top of Java language, is
'opinionated': instead of designing with Model, View, Controller components,
it's designed with 'unusual' components (as in not following any classic
architectures) e.g. Activity, Service, ContentProvider. You like it, you use
it. You don't like it, unfortunately you still have to use it. The real issue
here is a lot of developers depend on Android framework, and many of them seem
to struggle with the way it's structured, with no direct replacement (not
taking into account hybrid frameworks here).

The way I see it, architecture is an opinionated topic. Sure classic
architectures like MVC, MVP, MVVC are proven ones, but they serve as a
guideline at most. There is no right or wrong if you follow this and not
follow that. You are not happy with any of them, you make your own
architecture/pattern. Hell it's opinionated, you are allowed to have an
opinion here! If you think MVC or some other pattern is the right way to go,
then the author has the right to think her design is the right way. It just
keeps going on.

~~~
emidln
> You like it, you use it. You don't like it, unfortunately you still have to
> use it.

You always have the option of falling back to OpenGL-rendered widgets and
using a framework with MVC if you want to. Qt supports this, for instance.

------
0xFFC
Recently I was looking for one book desperately , a book that shows android
(and its apps) architecture, form low-level to high-level, design decision
which you should take when you design your app architecture. I hate how all
books are kind of reference manual. If I want to see what an API doing , I
will look at it documentation I don't need another book.But sadly most of
books written about android is just talking about API details.

p.s. If you know such book I would be grateful .

~~~
ktRolster
You might consider this book: [http://www.amazon.com/Android-Programming-
Ranch-Guide-Guides...](http://www.amazon.com/Android-Programming-Ranch-Guide-
Guides/dp/0321804333) I've read some of their books before, and they have good
understanding (and presentation) of architecture.

------
chickenbane
One of the biggest challenges for building on Android is its complexity, and
the team must successfully integrate with a lot of surface area conceptually
(the fundamental building blocks Dianne explains is just the start). This
unusually negative comment thread (for HN, I think) is probably illustrative
of how frustrating Android development can be.

On the other hand, it's been clear to me that Google is investing heavily in
making Android an easier platform to develop for.

First, the tooling: Moving to Gradle for the build system was a huge
improvement. Making a repeatable, extensible build is the vital with teams
moving towards the DevOps world with CI/CD. Android Studio has also been a
welcome change; all of the separate components of the build being integrated
together makes for a much better development experience. The best example of
this is Instant Run, which is a great accomplishment for the tooling team.

The Support Libraries are also a solid investment for implementing good
patterns - particularly patterns that can be tricky to implement yourself like
the separately sliding appbars. Getting more developers to adopt the support
libraries also allows more compatibility, since Google can release the fixes
independently from platforms.

YouTube has also been a great resource for Android developers as Google has
been constantly releasing content about how to build better apps. Jo and Ian
are really great.

Anyway, I would watch this space. It might be a coincidence that Dianne made
this post, or the most recent videos ("concurrent tasks with multiple
documents" and "tasks and back stack", respectively) were also about basic
Android features. Maybe Googlers are reflecting on what Android is due to the
current news of Oracle v Google. Or maybe it's because IO is this week. I'll
be watching!

~~~
HillaryBriss
I agree that moving to AS+Gradle was a net improvement (even though Gradle is
not always so quick) because it let us exactly reproduce the individual
developer's build on the CI server, as you say.

OTOH, I wonder how many devs really grok the Android gradle plugin and feel
comfortable just writing tasks themselves without carefully
copying/pasting/modifying some magical incantation from somewhere.

I feel like the verdict on Instant Run is still out though. We need to get
used to the complexity of IR's choices to restart the Activity or stop the
entire app and reinstall the apk etc and gain solid confidence that we can
just trust IR to _truly_ reproduce our code changes in its special, optimized
way.

~~~
vorg
> how many devs really grok the Android gradle plugin and feel comfortable
> just writing tasks themselves without carefully copying/pasting

That plugin uses Apache Groovy for its syntax, though in reality only a tiny
non-Turing Complete portion of Groovy's syntax is used in virtually every
build script out there. The main difficulty with Gradle is really the complex
API it exposes to Groovy, e.g. not knowing whether to use an = like in

    
    
        depos = {
          //stuff
        }
    

or

    
    
        depos {
          //stuff
        }

------
bengotow
I think it's fine for the Android team to take this approach like so many
framework authors before them. I think the problem is that Android developers
are seeking patterns and prescriptivist documentation because that's what many
other platforms offer these days.

On iOS, the message has always been clear: "Use MVC, delegates & data sources,
storyboards, etc. /We use them internally/ and you should too. Don't go re-
invent UIViewController!"

------
shade23
Tldr: that's how the system interacts, you are free to do what you want and
just use the framework for system interactions if you need them.

I guess this is a late reply but I feel the need to add in here considering I
began my career with Android devices and because of that have looked at
everything from that perspective(I write code for web apps, analytics, devops
too). What everyone seems to be focusing on is how broken the android platform
is. But no one sees the main theme of the post being that your code is really
not necessarily a part of the design. Take the entire Android environment ,
Android currently works on at least a million distinct devices which vary
massively in configurations (I include tv/wear/auto and maybe upcoming
platforms here too). This with a 6 month major release cycle (if you want to
argue about the necessity of this, it's a another topic). You really cannot
break everything in the next api level and neither can you make a simple
framework for the comfort of the newer programmers or people from other
environs. If you really want to get to the main bit of development, there are
several starter packs which can help you in the same. This would also explain
the sheer number of Android libraries available. this how the system works,not
your app. And unless you are building a system app you are free to do what you
want and interact with the system as it dictates, because more than the
Android system is designed to cater to the end user. It's not a product for
developers (I look at the ios development as a a product for devs and end
users).

Android development is frustrating and I have had my fair share of pointless
arguments on bugs which the Android team refuses to recognize. But when you go
through the AOSP code you see how much of can be done with the system. The
bitmap provider implementation for example is my go to code for whenever I
have to perform intensive processing.

The new memory manager is also an interesting piece of code which Android devs
should read. And all these were written while interacting with the same
framework.

------
johndifool
I remember her name. Wasn't she the one who vehemently was defending activity
lifecycle and other broken multi-threaded API, something every Android
developers I talked to would consider totally broken?

To be fair, developing on Android has become so insane releases over releases
that her crazy write up about no engineering design hardly comes as a
surprise...

Shame on Google for forcing us to use that POS.

~~~
ocdtrekkie
I met her once at Google I/O, and it wasn't a pleasant interaction. I was
lamenting how the recent (at the time) switch from USB Mass Storage to MTP
made file transfers to and from computers very iffy. (And it's still pretty
iffy today.) I was asking why the change was made, and if there was a chance
at the option for it being restored, as devices used to allow both.

A lot of times, files on the Android device don't show up properly in Windows
Explorer. She asked what I was doing, and I said copying APK files. (I
regularly used to backup APKs so I could revert software updates which
degraded the experience.)

She immediately stated that they "didn't support piracy" and walked off. As if
the process of sideloading APKs or transferring them to and from a PC was
somehow automatically illicit activity, rather than... something a lot of
developers probably do regularly.

~~~
ffiw
I see Android guys lack commonsense and I am not surprised. How did they think
you are pirating apk's after attending I/O event that costs fortune to enter ?

------
fighting
They really should have stuck with int main. What's unfortunate is the quantum
leaps they've been taking in terms of complexity to just get an app up and
running on their platform. But I guess that's the only way their engineers can
justify their salaries/bonuses. Same as with that horrific nightmare of an app
Facebook puts out.

~~~
mondoshawan
What would staying with the main entry point solve, aside from being familiar?

Your application would still have to directly manage binder callbacks and
register for lifecycle events. Re-using the old Java/POSIX entry point
actually increases the complexity significantly.

