Plugin project :url_launcher_web not found.
iq9891 opened this issue · 0 comments
iq9891 commented
环境
问题
因为本项目的依赖有增加 url_launcher 依赖,所以在运行或者打包 Android 版本的时候,会报如下错误:
Plugin project :url_launcher_web not found. Please update settings.gradle.
解决
- 在
android/app/build.gradle
中,将 minSdkVersion 版本改为 21,如:
android {
// ...
defaultConfig {
// ...
minSdkVersion 21
}
}
- 在
android/setting.gradle
中,全部替换以下内容:
include ':app'
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
}