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.
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.
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.
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:
- Mono.Data.Sqlite: Update to Xamarin.Android 6.0.4 or later and rebuild the app.
- SQite-net-PCL: Update to version 1.1.2 or later.
- Azure Mobile SQLiteStore: Version 2.1.1 and earlier relied on SQLitePCL from MS Open. Update to a newer version for updated SQLite dependencies.
- MVVMCross – SQlite PCL Plugin: Update to version 4.3.3 or later.
- Any NuGet relying on SQLitePCL.raw, should update to the latest 0.9.3. See the GitHub page for further details.
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.
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.
0 comments