【问题标题】:How to update settings.gradle file in flutter如何在颤动中更新 settings.gradle 文件
【发布时间】:2020-09-29 07:47:07
【问题描述】:

有时我们在 Flutter 中构建 apk 时会出错:

Plugin project :ANY_FLUTTER_PACKAGE not found. Please update settings.gradle. 

如何解决?

【问题讨论】:

    标签: android flutter plugins build apk


    【解决方案1】:

    你需要在flutter app -> android -> settings.gradle中添加这个

     def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
    
     def plugins = new Properties()
     def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
     if (pluginsFile.exists()) {
        pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
    }
    
     plugins.each { name, path ->
        def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
        include ":$name"
        project(":$name").projectDir = pluginDirectory
    }
    

    【讨论】:

      猜你喜欢
      • 2020-10-13
      • 1970-01-01
      • 2020-07-16
      • 2020-12-12
      • 1970-01-01
      • 2023-02-05
      • 1970-01-01
      • 2020-03-03
      • 2020-02-02
      相关资源
      最近更新 更多