Sunday, October 21, 2018

Improving Stability Past Times Reducing Utilisation Of Non-Sdk Interfaces

Posted yesteryear David Brazdil, Software Engineer

In Android, we're ever looking for ways to amend the user together with developer experience yesteryear making those experiences equally stable equally possible. In this spirit, we've been working to ensure that apps don't utilisation non-SDK interfaces, since doing together with then risks crashes for users together with emergency rollouts for developers. In Android N, we restricted the laid of symbols that C/C++ code could use. This alter ensured that apps using C++ rely on stable NDK interfaces rather than incur the incremental crashes caused yesteryear reliance on unstable, non-NDK interfaces. Starting inwards the adjacent liberate of Android, nosotros volition farther increase stability yesteryear expanding these restrictions to encompass the Java linguistic communication interfaces of the SDK.

What demeanor volition I see?

Starting inwards the adjacent liberate of Android, roughly non-SDK methods together with fields volition move restricted together with then that you lot cannot access them -- either directly, via reflection, or JNI. If you lot try, you lot tin encounter errors such equally NoSuchFieldException or NoSuchMethodException.

Initially, this restriction volition comport on interfaces alongside depression or no usage. It is an explicit destination of our planning together with pattern to observe our developer community together with do the absolute minimum of alter piece addressing app stability issues flagged yesteryear our users together with device manufacturers. In cases where a migration to SDK methods volition move possible but is probable to move technically challenging, we'll permit continued usage until your app is updated to target the latest API level. We excogitation to broaden these restrictions inwards hereafter platform versions, giving developers fourth dimension to migrate alongside long advance warning, together with besides giving us fourth dimension to assemble feedback virtually whatever needed SDK interfaces. We possess got ever said that using non-SDK interfaces is ever risky -- they mightiness alter inwards whatever liberate equally nosotros refactor code to add together features or ready bugs. So if your app currently relies on non-SDK interfaces, you lot should start out planning a migration to SDK alternatives.

Because the Java linguistic communication has unlike features from C++, this restriction volition accept a slightly unlike shape than the previous symbol restriction. You should non access classes that are non purpose of our SDK, but you lot besides involve to move certain that you lot are alone using the officially documented parts of each class. In particular, this way that you lot should non excogitation to access methods or fields that are non listed inwards the SDK when you lot interact alongside a degree via semantics such equally reflection.

What if at that topographic point isn't a SDK alternative?

We know that roughly apps may move using non-SDK interfaces inwards ways that do non possess got an SDK alternative. We value your feedback virtually where together with how nosotros involve to expand together with amend the populace APIs for you. If you lot experience that you'll involve the SDK API expanded earlier you lot tin halt using non-SDK ones, delight tell us via our põrnikas tracker. We volition move monitoring this listing closely together with using this valuable feedback to prioritize. It is critical for us to larn this feedback inwards a timely way together with then that nosotros tin expire along to both melody the blacklist to minimize developer comport on together with besides start out developing whatever needed alternatives for hereafter platforms.

What's coming next?

In the adjacent Android developer preview, you'll move able to run your existing apps together with encounter warnings when you lot utilisation a non-SDK interface that volition move dependent area to blacklist or greylist inwards the terminal release. It's ever a best practise to brand certain your app runs on the developer preview, but you lot should pay specific attending to the interface compatibility warnings if you lot are concerned that you lot may move impacted.

In conjunction alongside the adjacent developer preview together with the novel põrnikas tracker category, we'll move monitoring usage of non-SDK interfaces. In cases where official SDK alternatives already exist, we'll issue official guidance on how to migrate away from usually used non-SDK interfaces.

Related Post

Improving Stability Past Times Reducing Utilisation Of Non-Sdk Interfaces
4/ 5
Oleh