工作生活

Flutter-->AndroidX的适配

2019-07-09  本文已影响0人  谢尔顿

注意:如果是新项目,请在一开始就配置好AndroidX,避免在后面开发时,有些插件不能用;如果是旧项目,先将项目的所有插件升级到最新到版本,然后在进行AndroidX的适配

工程目录

上图红框标注的是适配AndrodX涉及到的文件。

  1. 首先在文件gradle.properties中添加下面内容:
android.useAndroidX=true
android.enableJetifier=true
  1. 其次是app的gradle文件中的修改
...
android {
    compileSdkVersion 28   
    defaultConfig {
        targetSdkVersion 28
   }
}
dependencies {
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

compileSdkVersion和targetSdkVersion必须是28以上,还有就是dependencies中那两行的修改。

上一篇 下一篇

猜你喜欢

热点阅读