In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "AndroidStudio Project adaptation AndroidX (Android9.0) method tutorial". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Say in front:
Old projects, large projects adapt to Android X attention, must be cautious, cautious, and then cautious. It can be troublesome if many third-party libraries are used in the project, and some third-party libraries have not yet been adapted to Android X.
There are two situations of adapting to Android X: one is that the old project adapts to Android X, and the other is that the new project requires adaptation to Android 9.0.
Hard core requirement
Android studio version upgraded to 3.2.0 or above, distributionUrl version upgraded to 4.10.1 or above, targetSdkVersion 28gradle plug-in version upgraded to 3.2.0 or above
Classpath 'com.android.tools.build:gradle:3.2.0'
Take AS 3.4 as an example.
Step one:
New project, this step can be skipped.
CompileSdkVersion 28 defaultConfig {applicationId "gangqing.pu.xmxidaq" minSdkVersion 19 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}
Step 2:
/ / Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {repositories {google () jcenter ()} dependencies {classpath 'com.android.tools.build:gradle:3.4.0' classpath' com.jakewharton:butterknife-gradle-plugin:10.1.0' / / NOTE: Do not place your application dependencies here They belong / / in the inpidual module build.gradle files}} allprojects {repositories {google () jcenter () maven {url "https://jitpack.io"} task clean (type: Delete) {delete rootProject.buildDir}
Step 3:
Add the following code to gradle.properties to indicate support for Android X
Android.useAndroidX=trueandroid.enableJetifier=true
Step 4:
Android Studio-> Refactor---- > Migrate to androidx, one click to androidX
Step 5:
Support for Java 1.8
CompileOptions {sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8}
Step 6:
Modify the layout, such as ConstraintLayout
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.