In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what the operation steps of Androidgradle configuration extraction merge are, the content is concise and easy to understand, and it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
First, why merge
When there are too many model or library in the project, such as using componentization or introducing third-party libraries, you need to configure multiple build gradle files, and once you need to unify its SDK or other component versions, you need to modify multiple files at the same time, which is really troublesome, so it is very necessary to extract gradle configuration. If you want to modify the version after extraction, you only need to modify the public file.
Second, how to operate the file
1. Create a new gradle folder
1. Function: store extracted public gradle files
two。 Operation steps
Create a new gradle folder (Directory) in the project home directory
Create a new androi.gradle file under the gradle folder
Copy all the content in app.gradle and modify it based on it
First modify the file type declaration on the first line
Originally: apply from: 'com.android.application'
Modified to: project.plugins.apply ("com.android.application")
Now introduce it into app.gradle or other model (the same is true for library, but the file type is different and you don't need applicationID). The build reference is successful.
Apply from:'.. / gradle/android.gradle'
two。 Create a new config folder
1. Function: to store public configuration files such as sdk version numbers
two。 Operation steps
Create a new config folder in the project home directory
Then create the subfile config.gradle (of course, you can also put it under the gradle folder)
Introduce under project
Apply from:'/ config/config.gradle'
Write the configuration content, taking model as an example:
Ext {androidVersion = [minSdkVersion: 23, targetSdkVersion: 29, versionCode: 1, versionName: '1.0.0, compileSdkVersion: 29, buildToolsVersion:' 29.0.2, applicationId: 'com.xxx.plugin_package']}
5. Defined in android.gradle
Def config = rootProject.ext.androidVersion
6. Use in android.gradle
III. End
The above example of extracting a public configuration, including many other attributes, can be extracted and merged in this way, including dependencies.
The above is what the procedure of Androidgradle configuration extraction merge is. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.