按照上一篇博客的设置,已经可以愉快地玩flutter了。
但是,当我开始使用第三方package时(flutter_blue),安装依赖噩梦再次降临。
反正症状跟之前的一样。照理将gradle-wrapper.properties里的gradle版本改为4.6,但这次不管全局翻墙还是在Android studio里设置socks代理,都没有用。最后抱着试试看的心态把Android studio的proxy改为http代理,竟然不再报443了。。。
但安装依赖时候还是报错了。提示信息并未能看出啥来,于是切换到工程的android目录下,手动运行./gradlew build --stacktrace,看到这么一段信息:
* What went wrong:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:flutter_blue] /Users/lynx/Android/flutter_app/build/flutter_blue/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml as the library might be using APIs not available in 16 Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 19, or use tools:overrideLibrary="com.pauldemarco.flutterblue" to force usage (may lead to runtime failures)
知道原因就好办了。打开app/build.gradle,把默认的minSdkVersion从16改为19,之后编译通过。