September 9th, 2016

Preparing for Native Library Linking Changes in Android N

James Montemagno
Principal Manager, Tech PM

Android Nougat (7.0) has officially been released with several new features for developers to take advantage of, but also a few important behavior changes. At the top of the list of updates that may impact your application is the change to Android apps linking to platform libraries. This change disallows apps from dynamically linking against non-NDK libraries and may cause your app to crash. Even if your app is not specifically linking against a private library, you may be using a library that is, such as SQLite (which uses the platform libsqlite.so) or other libraries that are linking against libcutils.so, libcrypto.so, or libssl.so. It’s important to start testing now to see if your application needs to be updated in accordance with these changes.

How to Test

If you had a device running any of the Android N developer previews and saw a toast message about linking to native libraries, then you most likely will need to update a library in your app. PopUP

Even if you didn’t see a toast, it’s still important to test your application for native library usage. You can start up the Android Device Monitor (DDMS) to watch the log in warning mode. DDMS

Note: if you have issues launching DDMS it may be because you have spaces in your user name. See this article for a quick resolution.

Boot up your application. If you see a warning like the one below, it will help identify if your app is using a private library. Capture

Common Libraries Impacted

Out of all of the private libraries that were shipped with Android, the most common that was dynamically linked against was libsqlite.so, which was used by nearly all common SQLite libraries. Below is a list of common libraries and compatibility with Android N:

When to Update

If your application currently has it’s Target API Level (android:targetSdkVersion in the AndroidManifest.xml) set to 23 or lower, your application will work as expected in the Final Android N Release, but you will receive a logcat warning. If you’re looking to target and use the latest Android N APIs and set your target to 24 or higher, you will receive a runtime error. In future Android platform releases all applications, no matter what the target, will receive a runtime error, so it’s important to test and update your app today.

UpdateSchedule

Next Steps

After updating any libraries that are linking against native libraries, be sure to check your release packages in logcat for final validation. You can find more information on this behavior change and others on the Android developer portal.

Author

James Montemagno
Principal Manager, Tech PM

James Montemagno is a Principal Lead Program Manager for Developer Community at Microsoft. He has been a .NET developer since 2005, working in a wide range of industries including game development, printer software, and web services. Prior to becoming a Principal Program Manager, James was a professional mobile developer and has now been crafting apps since 2011 with Xamarin. In his spare time, he is most likely cycling around Seattle or guzzling gallons of coffee at a local coffee shop. He ...

More about author

0 comments

Discussion are closed.