Error reported when adding glide library for Android: failed to resolve: com.android.support: support annotations: 26.0.2 solution

preface

Glide is a picture loading library recommended by Google. It can support the loading of pictures from URLs, Android resources, files and URIs. It also supports the loading of GIF pictures, as well as the bitmap processing before the display of various pictures (such as fillet pictures, circular pictures, Gaussian blur, rotation, gray scale, etc.), cache processing, request priority processing, animation processing, thumbnail processing, Custom image size and so on. It can be said to be very powerful

In terms of the use of glass, it is similar to Picasso's use method, and their operation mechanism also has many similarities. Many blogs will compare the two. This article also adopts the same way to learn their advantages and disadvantages by comparing the two.

First of all, when we use these two libraries, the first step is to import the libraries. Picasso can say that it is OK to rely directly, but glide should note that this library depends on support library V4, so when using this library, don't forget to rely on V4 package.

Today, I will mainly talk about a problem encountered in using glide and make a record.

Glide latest version

The latest version of glide is:

When adding library dependencies, the following errors occur during compilation:

A silly B on your face. What the hell is this support annotations?

Introduction to support annotations:

Android support library constantly introduces new annotation libraries, which contain many useful meta annotations. You can use them to modify your code and help you find bugs. The support library itself uses these annotations, so as a user of the support library, Android studio has verified your code based on these annotations and marked the potential problems.

How to import support annotations: annotations are not included by default; It is packaged as an independent library. If the appcompat library is used, support annotations will be automatically introduced because appcompat uses support annotations. If not, the following configuration needs to be added in build.gradle:

If you have introduced appcompat V7, it may not be necessary to add such annotations again.

Causes of problems

Support annotations since 25.4.0, the support package has not been updated in the SDK. We need to use Google's Maven library to add the following Google address to project's build.gradle. Therefore, we need to manually add the following Google address to project's build.gradle:

When you finish compiling again, you will magically find that it has been solved.

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>