First Preview of Android N: Developer APIs and Tools
android-developers.blogspot.com
android-developers.blogspot.com
>Improved Java 8 language support - We’re excited to bring Java 8 language features to Android. With Android's Jack compiler, you can now use many popular Java 8 language features, including lambdas and more, on Android versions as far back as Gingerbread. The new features help reduce boilerplate code. For example, lambdas can replace anonymous inner classes when providing event listeners. Some Java 8 language features --like default and static methods, streams, and functional interfaces -- are also now available on N and above. With Jack, we’re looking forward to tracking the Java language more closely while maintaining backward compatibility.
It depends. For example, let's compare providing an event listener via a lambda vs an anonymous inner class. Using the lambda will increase your method count by 1. However, if you're accessing class member variables, it will reduce the method count for each variable you use, because it's added as a method of the containing class and doesn't need to generate accessors.
ART will recompile applications based on profiling data.
Introduction of support to hardware keystores, with the mention that one use case is to prevent jailbreaking.
Prevent the NDK users that ignored the documentation and linked to non official platform libraries to keep doing that.
They went back to having a JIT in addition to AOT - which means there is no AOT when the app is installed. When the device is idle/charging then AOT will selectively precompile the used portions of the app and optimize it further using the profiling data. So faster app installs (boon for FDE devices with slow NAND write speeds) and no optimizing apps step after system update.
That is fantastic news. Every single time my Nexus 6P gets an update it feels like it takes at least 15 minutes to "optimize apps". Every. Single. Update.
Just what I can think of as similar, still need to dig deeper into what it actually means for Android.
WP 8.x only use a dynamic linker on the device.
WP 10 are fully compiled and linked on the store. Although the dynamic linker option is still there as well.
In Android, it is possible to use third-party stores or sideload apps. Or you can develop your own app totally offline.
In Windows Phone it is also possible to sideload.
> Or you can develop your own app totally offline.
You can compile .NET to native code via release builds, before deploying it to the Windows Phone.
It is only when you upload the appx to the store that MSIL is still used.
But I agree that with Windows Phone and now with iOS going bitcode as well, there isn't the issue of third party stores.
Still, nothing would prevent such stores to offer a server compiler service.
Good to know. I was under impression (since WP7 was a current OS, I admit) that you have to upload to MS/have it signed/download.
> Still, nothing would prevent such stores to offer a server compiler service.
Nothing prevents that technically. However, it would mean a tighter coupling between platform owner and majority store owner, Google probably wants to avoid that. It could destroy the open-source nature of Android, since for now the Play Store is layered above open-source platform; this compiler would not fit there, it would have to go below, into the layer that is currently open source.
The big question in my mind is how they will balance first-run performance against the desire for fast installs. People's impression of an app is determined by their first run. If it's slow, because nothing has been compiled yet, and if it doesn't get fast until that night when the phone is charging, then that's going to be a huge problem for a lot of developers. If you can ship a pre-calculated profile with the app and that's used to do AOT compilation of the hotspots at install time, that'd represent an excellent balance.
This makes no sense, android already has hardware keystore support, jailbreaking is an ios term, and this is not mentioned anywhere in the lost...?!
I'm sorry, where in the article did you see that? I've looked twice and can't find it.
"Android N includes namespace changes to prevent loading of non-public APIs. If you use the NDK, you should only be using public APIs from the Android platform. Using non-public APIs in the next official release of Android can cause your app to crash."
Definitely super excited for Android itself to have this feature.
I'm just a hobby developer, but the last four-ish months have been really exciting. There's a been ton released and polished in the developer console alone.
It would be absolutely amazing if Google came out with a mechanism for building native apps in, say, Rust.
To an extent, that partially exists in the form of Android NDK, but that's not really a full solution. If and when Google makes it possible to easily create your entire app natively (with a clean C API), then you ought to see a surge of libraries/toolkits/frameworks coming out that will enable you to write Android apps in most common languages (Rust likely included).
It adds very little value over Java + NDK on Android.
The Android native widgets aren't supported, rather emulated via QML and only the most well known ones.
For the majority of Android APIs no support is provided, offering no advantage over we having to write our own JNI wrappers.
Also iOS and Windows Phone support are even worse than Android.
If I have to spend time writing bindings to OS APIs and faking UI widgets for each OS I am targeting, then the framework is not doing anything to help me, rather on the contrary.
As extra info, on 5.3 some of the C++ widgets render on Android as if it was a desktop. Just try to use a Qr file selector on your phone.
Apparently this has worked so well that 5.6 is going to have yet another re-write of the controls.
The last years the NDK support has always been seen as something to help bring "legacy" code from other platforms, be consumed from Java to help speed up some algorithms, games.
In fact, apparently they are now closing down the door to rogue developers that used to link to unofficial platform libraries.
If you look at the Tango SDK, apparently they have a C API to some platform APIs, however when one digs into them, they are wrappers to functionality implemented in Java.
While the NDK is hard to use, it is enough to enable alternate modes of Android development. For instance with Unity you can develop and Android app using C# and the Unity graphical editor. That's a very powerful option for certain classes of apps.
Having an API that is easy to use would really open up the ecosystem. Also, having much faster, machine targeted code (ie: compiled with CPU architecture and model specific optimizations and instructions) in C, C++, Rust, Go, etc. would mean better performance and less battery usage in some apps, which overall would translate to a superior user experience.
Only for users of devices that the dev bothered to put out binaries for. I guarantee you most devs that use the NDK are not building for all 8 ABIs that the NDK supports. ARMv7-neon may be the most common arch but it is far, far from the only one.
Also they could in theory do escape analysis to do stack allocation.
And assuming Google does indeed keep up with Java versions, eventually value types will be supported.
The only way they are going to move away from all the framework code they have invested in Java (the language) is if they create a common runtime like WinRT or Objective-C runtime.
However, it is quite telling that the Android team doesn't even bother to add Go or Dart support to the NDK.
It's java the language we are talking about. Basically kotlin or dart targeting the jvm.
[0] http://www.androidpolice.com/2016/03/09/android-n-feature-sp...
Too many top apps were dependent on constantly waking up and doing network or other expensive jobs. So for M Google says 'these things won't happen when the user leaves the phone on a desk for 30m+' which spurs people to prepare for this new world even if they won't encounter it much. Now with N Google is saying 'this will happen when the screen is off for a few minutes' and now any decent app needs to prepare for this, but the best apps already got into this new world for M.
That's really the thing doze is great at. If you forget to charge your phone, you wake up with still decent amount of battery left. Or for tablets sitting around on tables/desks.
I do however, sit/stand at my desk for 8-9 hours a day and maybe pull the phone out less than once an hour. I would like the phone to be in Doze mode when it's in my pocket, rather than forcing me to have to put it on my desk. As I said, I don't like leaving it unattended, even if it's simply to step away for a few minutes to the watercooler.
Doze backs off sync period, trading timeliness for battery life. That's why significant motion prevents it from happening, it assumes that if it's on your person then syncing is important. Which is a generally true assumption.
Jelly Bean still has 30% market share, but are owners of 4 year old phones a significant portion of app revenue? I'd wager the people spending money have at least KitKat.
Lollipop, at a year and half old, has another 30%
Digital Signage platforms especially (the part of the Android market I actually care about) seem to be largely stuck on 4.1.
the part of the Android market I actually care about
Don't know if I wasn't paying enough attention when I replied, or if you ninja-edited, but that's certainly relevant context.
I have millions of installs for my apps and my minSdk is 16, and I'm very close to bumping it to 19.