Android support libraries are an essential part of every Android app and you'll find them everywhere. The support library provides developers with the ability to add the latest and most powerful features of Android to the application while maintaining backward compatibility with older versions of Android. As the new version of the Android SDK continues to roll out, updates to the support library also follow; keeping the latest version and installing the correct version is an important (and sometimes frustrating) part of Android development. In this blog, I want them to uncover support libraries to help you upgrade to the latest version
650) this.width=650; "class=" AlignCenter size-full wp-image-32389 "src=" https://s3.amazonaws.com/blog.xamarin.com/ Wp-content/uploads/2017/07/05095037/supportlibraries.png "height=" 381 "width=" 568 "/>
Version control
The first thing to understand is how to support the library version. We talked about this topic a few weeks ago with Jon Dick on the Xamarin blog, but there's a quick crash: Every support library nuget has a semantic version number (big, small, patched) with the Java version of their peers, so You can view the content in each version by viewing the revision history revision history. Sometimes you'll see an additional fourth patch at the end to mark the bug being modified on NuGet. Like this blog, the latest version of NuGet that Xamarin developers have access to is 25.3.1. The most important number is the major version number 25. This number means that this is built for Android SDK API level 25 means to install NuGet and use it correctly, you must choose API 25 or later to re-compile in Visual Studio, otherwise you may see this error:
Could not install the package ' Xamarin.Android.Support.Compat 25.3.1 '. You is trying to install this package into a project that targets ' monoandroid,version=v7.0 ', but the package does not co Ntain any assembly references or content files, that is compatible with the.
Update Support Library
Now that we have installed the full version of the support library, we are able to update our Ask US library to the latest version. At this point, you may want to know why you need to update the library. The support library adds new features over time, but it also provides several bug fixes that the application requires. In addition, you may rely on other support libraries such as the Google Play service or the Xamarin plugin, which may be created for the latest support package. In fact, recognizing that it is time to update, I recently updated all my plugins to the target. NET standards and up-to-date support libraries. All of my plugins to the target. NET standards and up-to-date support libraries.
Step 1: Install Android SDK 25
To recompile with API 25 as shown above, you need to install the API Android SDK. In the Android SDK Manager, via the menu Tools->android->android SDK Manager ..., I found the SDK manager and updated to API 25. The first thing to do is confirm that you "cancel all selections" and find the SDK Platform 25 under Andorid 7.1.1. You need to install a package. (If you're using visual Studio for MAC, read the latest SDK manager we've provided).
650) this.width=650; "class=" AlignCenter size-full wp-image-32392 "src=" https://s3.amazonaws.com/blog.xamarin.com/ Wp-content/uploads/2017/07/05101132/install25.png "height=" 259 "width=" 687 "/>
After installation, we need to select this SDK to recompile:
650) this.width=650; "class=" AlignCenter size-full wp-image-32391 "src=" https://s3.amazonaws.com/blog.xamarin.com/ Wp-content/uploads/2017/07/05101047/compile251.png "height=" 265 "width=" 882 "/>
In addition, the best practice is to set the target to the same version as the compiled version.
650) this.width=650; "class=" AlignCenter size-full wp-image-32393 "src=" https://s3.amazonaws.com/blog.xamarin.com/ Wp-content/uploads/2017/07/05101303/target25.png "height=" 127 "width=" 471 "/>
At this point, it is strongly recommended that you close and reopen the solution. This will ensure that all your settings are synchronized to prepare nuget to kick into action. When you upgrade, you see an error, and if you do not set the compilation target correctly and do not work, then you will not target the correct version of Android.
Step 2: Update nugets
Now is the time to update the support Nugets. It is important to update all of the support libraries that you have installed. Failure to do so will result in mismatched versions and compilation errors. Right-click on the Android project and select "Manage NuGet Packages ..." and on the Update tab you will see a list of the targets that support the library. Simply select all packages and click "Update".
650) this.width=650; "class=" AlignCenter size-full wp-image-32394 "src=" https://s3.amazonaws.com/blog.xamarin.com/ Wp-content/uploads/2017/07/05102132/updates.png "height=" 724 "width=" 970 "/>
This will ensure that all nugets and dependencies are updated. You may be prompted to close and restart VisualStudio; Make sure you do so so that the project is fully updated.
If you're using Visual Studio's Mac, you'll see a nugets update in your project's package knot. You can update one at a time or right-click a package node and update all.
after the update, I always want to recheck all the packages that have been updated by closing the solution and open it again, repeating step 2. After you have done this, make sure that you have completed the full cleanup and then completed the project recompilation.
You have it, your support library is up-to-date and ready for work!
Video Walkthrough
Want to see it in action? Please watch the video below and hands-on exercises:
Https://sec.ch9.ms/ch9/97d8/d2604d3d-94ae-42d5-8ca2-be0793e997d8/SnacKPackUpgradeAndroidSupportLibraries_high.mp4
This article from "Wangccsy" blog, reproduced please contact the author!
Mastering the Android Support Library