Home > Blockchain >  Flutter iOS build fail after upgrade to 3.0.5
Flutter iOS build fail after upgrade to 3.0.5

Time:07-29

Since flutter upgrade to 3.0.5 (MacOS : Monterey 12.5, Xcode : 13.4.1, Flutter : 3.0.5, channel stable, Dart 2.17.6, DevTools 2.12.2),

iOS build fails.

I get tons of repeating output in the log, so I just put the beginning of the parts below.

I've tried to [remove iOS folder] and [flutter create .],

[flutter clean] -> [pod deintegrate] -> [pod repo update] -> [pod install] -> [pod update].

Nothing works, and I don't know what else I can do now.

If anyone had a same issue, please help.

Writing result bundle at path:
    /var/folders/f9/7grwc3ls1wb7q21j989mvww00000gn/T/flutter_tools.LCeiN7/flutter_ios_build_temp_dirhFJ00P/temporary_xcresult_bundle

/Users/username/Desktop/packageName/ios/Pods/libwebp/src/enc/backward_references_enc.c:694:12: warning: variable 'best_offset' may be uninitialized when used here [-Wconditional-uninitialized]
          (best_offset << MAX_LENGTH_BITS) | (uint32_t)best_length;
           ^~~~~~~~~~~
/Users/username/Desktop/packageName/ios/Pods/libwebp/src/enc/backward_references_enc.c:626:20: note: initialize the variable 'best_offset' to silence this warning
    int best_offset;
                   ^
                    = 0
1 warning generated.
4 warnings generated.

/Users/userName/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications-9.5.0/ios/Classes/FlutterLocalNotificationsPlugin.m:13:3: warning: 'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest [-Wdeprecated-declarations]
  UILocalNotification *_launchNotification;
  ^
In module 'UIKit' imported from /Users/userName/Desktop/packageName/ios/Pods/Target Support Files/flutter_local_notifications/flutter_local_notifications-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalNotification.h:18:12: note: 'UILocalNotification' has been explicitly marked deprecated here
@interface UILocalNotification : NSObject<NSCopying, NSCoding>

/Users/username/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/ios/Classes/ReachabilityConnectivityProvider.swift:23:5: warning: result of call to 'ensureReachability()' is unused
    ensureReachability()
    ^                 ~~
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-3.3.20/lib/src/recaptcha_verifier.dart:57:27: Error: Required named parameter 'auth' must be provided.
      _factory.delegateFor(
                          ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/in_app_purchase-0.5.2/lib/src/in_app_purchase/google_play_connection.dart:32:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addObserver(this);

../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image_library-3.2.0/lib/src/platform.dart:41:28: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null.
 - 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/painting/binding.dart').
    return PaintingBinding.instance?.imageCache;
                           ^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/confetti-0.6.0/lib/src/confetti.dart:229:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Developer/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance!.addPostFrameCallback((_) {


Failed to package /Users/username/Desktop/packageName.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order

Result bundle written to path:
    /var/folders/f9/7grwc3ls1wb7q21j989mvww00000gn/T/flutter_tools.LCeiN7/flutter_ios_build_temp_dirhFJ00P/temporary_xcresult_bundle

This is my Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
 installer.pods_project.targets.each do |target|
 flutter_additional_ios_build_settings(target)
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
  end
 end
end

CodePudding user response:

You can try to check this checkmark. [CP] Embed Pods Frameworks/Run Script: enter image description here

If this is already checked, you can try to uncheck it.

CodePudding user response:

These errors means that the packages you are using has got a widgetbinding which can be null but flutter 3 expects it to be non null. For example in app purchase you have used is 0.5.2 which doesnt support flutter 3. Latest is 3.0.6. Upgrade all packages. Then in terminal in ios directory run

pod install --repo-update

Then try again. Please note all packages you use should be flutter 3 compatible. Please take a backup before you switch dependencies

  • Related