【Flutter】遭遇したエラー&&解決策まとめ

公開:2020/12/12
更新:2021/01/14
2 min読了の目安(約2400字TECH技術記事

次回

参考文献

【Podライブラリの警告】

◆ エラー内容

The iOS Simulator deployment target ‘IPHONEOS_DEPLOYMENT_TARGET’ is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.

◆ 解決策

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end
$ pod update

【GoogleDataTransportエラー】

◆ エラー内容

error: umbrella header for module 'GoogleDataTransport' does not include header 'GDTCORDataFuture.h'

◆ 解決策

$ rm -rf Pods
$ flutter clean
$ flutter run //pod installが自動実行される

「firebase_core_web not found」エラー

◆ エラー内容

Plugin project :firebase_core_web not found.
Please update 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
}

【「Firebase.initializeApp」エラー】

◆ エラー内容

No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

◆ 解決策

Widget _buildBody(BuildContext context) {
    Firebase.initializeApp(); // new