Detailed explanation of two problems encountered in Android upgrade support library version
preface
As early as 2011, it was released as an Android compatible library and has been used in 75% of applications. It is the most widely used Android library. In fact, it is not a single file, but a collection, which can be roughly divided into two groups: compatibility library and component library.
Each library indicates the minimum supported SDK version. It is easy to make a mistake that the high version support library can easily be understood as covering all the contents of the low version support library. In fact, this is not the case. (you may think V7 appcompat includes V4, but it's not).
Before the company's project, the version of support library was chaotic. There were several versions of V7 package and V4 package for each moudle, and the version was still relatively low. Today, I took the time to unify the versions of support library and buildtoolsversion, but I encountered two problems and recorded them.
1. Upgrade buildtoolsversion to 26
The latest buildtoolsversion has reached 26. As before, directly change the reference version after buildtoolsversion to 26.0.2 in the build file, and then synchronize it. If it is found that it cannot be compiled, it will be prompted:
After checking, starting from SDK 26, you need to add the following contents to the repositories of the build file in the root directory:
Compile again, successful.
2. Hiding actionbar in theme setting is invalid
Initially, my version of appcompat-v7 was 20, so the activity inherited actionbaractivity, so it is useful to set it in the style file as follows:
After upgrading to 26.1.0, actionbaractivity is replaced by appcompatactivity. At this time, Android: windowactionbar cannot be set. Change to the following method
That is, remove "Android:". As for the difference between the two writing methods:
If Android: is added before the attribute name, the attribute is specified under the Android package.
The base style apptheme of the project inherits from theme.appcompat and is located in appcompat-v7 library instead of Android package. So wrong
Use Android: windowsactionbar and Android: windowstittle by mistake. You should use windowsactionbar and windowstittle
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.