Java 将现有的 android 支持转换为 androidX
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55428697/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Converting existing android support to androidX
提问by Zeeshan Ahmad
I am working on an existing project. I want to convert my android project(oreo) from the support library to androidX library. I have tried many tricks and tips but no progress at all.
我正在处理一个现有的项目。我想将我的 android 项目(oreo)从支持库转换为 androidX 库。我尝试了很多技巧和技巧,但根本没有任何进展。
What is the easiest approach to do that?
最简单的方法是什么?
采纳答案by Ahmed Mujtaba
Update your android studio
Set compileSdkVersion to 28
Set com.android.tools.build:gradle:3.2.0 in build.grade(project:X) in dependencies to min 3.2
Go to Refactor-> Migrate to androidX
更新你的安卓工作室
将 compileSdkVersion 设置为 28
将依赖项中 build.grade(project:X) 中的 com.android.tools.build:gradle:3.2.0 设置为 min 3.2
转到重构-> 迁移到 androidX
回答by Praveen
Try this
尝试这个
With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidXfrom the menu bar.
使用 Android Studio 3.2 及更高版本,您可以通过从菜单栏中选择Refactor > Migrate to AndroidX快速迁移现有项目以使用 AndroidX 。
If you have any Maven dependencies that have not been migrated to the AndroidX namespace, the Android Studio build system also migrates those dependencies for you when you set the following two flags to true in your gradle.propertiesfile:
如果您有任何尚未迁移到 AndroidX 命名空间的 Maven 依赖项,当您在gradle.properties文件中将以下两个标志设置为 true 时,Android Studio 构建系统也会为您迁移这些依赖项:
android.useAndroidX=true
android.enableJetifier=true
For Reference
供参考
回答by Srikar Reddy
It is very simple. You have to click on the Refactormenu option and then click Migrate to AndroidXoption.
这很简单。您必须单击Refactor菜单选项,然后单击Migrate to AndroidX选项。
This article gives step by step procedure to Migrate your project to AndroidXpackages.
本文提供了将项目迁移到 AndroidX包的分步过程。
Disclaimer:I'm the author of the blog.
免责声明:我是博客的作者。