Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] App is crashing with "uncaught exception FIRAppNotConfigured" when trying to scan barcode #172

Closed
paj-co opened this issue Nov 24, 2021 · 9 comments

Comments

@paj-co
Copy link

paj-co commented Nov 24, 2021

I'm migrating from google_ml_kit ^0.6.0 to ^0.7.3 version.

1. Problem

After making changes in Podfile, this lines

if Gem::Version.new($iOSVersion) > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = $iOSVersion
end

are causing an error:

[!] An error occurred while processing the post-install hook of the Podfile.

[Xcodeproj] Consistency issue: build setting `IPHONEOS_DEPLOYMENT_TARGET` has multiple values: `{"Release"=>"10.0", "Debug"=>"9.0", "Profile"=>"9.0"}`

However, when commented / removed, pod install finishes with success.

2. Problem

When above lines in Podfile are commented, and I'm trying to scan QR code, the app is crashing.
And it seems like processImage method from BarcodeScanner class is causing it:

await barcodeScanner.processImage(inputImage);

So it seems, like there is some problem with communication with native code?

(Maybe this problem is related to the first one?)

I'm testing on iPhone 6 with iOS 12.5.5.

Flutter doctor:

Click To Expand
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale en-PL)
    • Flutter version 2.5.3 at /Users/przemek/Development/flutter/flutter_latest/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (6 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/przemek/Library/Android/sdk
    • Platform android-30, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.1, Build version 13A1030d
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.62.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPhone (Przemysław) (mobile) • 4e43f4d27a726d39c56b7146669b0d369e4bcb99 • ios            • iOS 12.5.5 16H62
    • Chrome (web)                 • chrome                                   • web-javascript • Google Chrome 96.0.4664.55

@paj-co paj-co changed the title pod install "IPHONEOS_DEPLOYMENT_TARGET has multiple values" error pod install "IPHONEOS_DEPLOYMENT_TARGET" has multiple values" error Nov 24, 2021
@paj-co paj-co changed the title pod install "IPHONEOS_DEPLOYMENT_TARGET" has multiple values" error pod install "IPHONEOS_DEPLOYMENT_TARGET has multiple values" error Nov 24, 2021
@paj-co
Copy link
Author

paj-co commented Nov 25, 2021

Ok, it seems, that I solved 1 problem. I wanted to combine Podfile configuration from 2 different packages, and I misplaced lines mentioned above. When flutter_additional_ios_build_settings(target) is above target.build_configurations.each do |config| everything seems to work fine.

But 2 problem still exists.

@paj-co
Copy link
Author

paj-co commented Nov 26, 2021

I have run project in Xcode instead of Android Studio. In Xcode I have got this error output:

2021-11-26 13:02:55.789027+0100 Runner[1712:149917] [DYMTLInitPlatform] platform initialization successful
2021-11-26 13:02:56.663451+0100 Runner[1712:149813] Metal GPU Frame Capture Enabled
2021-11-26 13:02:56.664736+0100 Runner[1712:149813] Metal API Validation Enabled
2021-11-26 13:02:57.207487+0100 Runner[1712:149952] flutter: Observatory listening on http://127.0.0.1:64172/80OnAgy-g6Y=/
2021-11-26 13:03:23.633495+0100 Runner[1712:149813] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2021-11-26 13:03:23.634187+0100 Runner[1712:149813] [MC] Reading from public effective user settings.
2021-11-26 13:03:24.351666+0100 Runner[1712:149966] The selected imageFormatGroup is not supported by iOS. Defaulting to brga8888
2021-11-26 13:03:25.378486+0100 Runner[1712:149999] 8.9.1 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `FirebaseApp.configure()` to your application initialization. This can be done in in the App Delegate's application(_:didFinishLaunchingWithOptions:)` (or the `@main` struct's initializer in SwiftUI). Read more: https://goo.gl/ctyzm8.
2021-11-26 13:03:25.383763+0100 Runner[1712:149813] *** Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'The default Firebase app instance must be configured. To configure, call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).'
*** First throw call stack:
(0x23699f180 0x235b779f8 0x2368a93a0 0x101a30768 0x101a31fdc 0x101a31f5c 0x1008e3620 0x1008e3870 0x1008e3d90 0x100a48174 0x100a4760c 0x100a47864 0x100a45cc8 0x100a45b6c 0x1008fa22c 0x104859ec4 0x104859bcc 0x104861b98 0x107dd17f8 0x10791df00 0x107c295f0 0x107bce39c 0x107bd1994 0x236931554 0x236931284 0x236930ab8 0x23692ba08 0x23692afb4 0x238b2d79c 0x263377c38 0x1008e2250 0x2363ee8e0)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'The default Firebase app instance must be configured. To configure, call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).'
terminating with uncaught exception of type NSException
(lldb) 

So it seems, that there is a problem with Firebase configuration. On Android everything works fine.

@paj-co paj-co changed the title pod install "IPHONEOS_DEPLOYMENT_TARGET has multiple values" error [iOS] App is crashing with "uncaught exception FIRAppNotConfigured" when trying to scan barcode Nov 26, 2021
@yuexunshi
Copy link

yuexunshi commented Dec 23, 2021

  1. ios/Podfile:
target 'Runner' do
  use_frameworks!
  use_modular_headers!
# add this line
  pod 'Firebase'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
  1. ios/Runner/AppDelegate.swift:
import Flutter
// add this line
import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
// add this line
    FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

@Marchewson
Copy link

hello, the solution that @yuexunshi gave throws another error "terminating app due to uncaught exception 'com.firebase.core', reason: 'FirebaseApp.configure() could not find a valid GoogleService-Info.plist in your project. Please download...'". What should I do?

@saflisgit
Copy link

You can get GoogleService-Info.plist file by following steps in this link https://firebase.google.com/docs/ios/setup. Then locate the file under under ios/Flutter folder (not sure about location, may be ios/Runner).

@Marchewson
Copy link

Thanks for the reply. But then my app will use Firebase when used on iOS? And i will be charged probably? I think that the whole point of this plugin was not to use firebase but ML Kit on device?

@LeventeAsztalos
Copy link

Hi, I have the same problem. On android it works fine though. I also don't use any other firebase plugin. Any idea what could be the problem?

@paj-co
Copy link
Author

paj-co commented Jan 11, 2022

It seems that if @yuexunshi solution works, there must be Firebase added to the project. Unfortunately my project is firebase-free and there are no plans to add it in the near future.
So it would help if solution would come from within package itself.

@fbernaly
Copy link
Collaborator

Try the latest version.

Also note that google_ml_kit has been split in multiples plugins, to avoid adding unnecessary dependencies to your project. You can start using google_mlkit_barcode_scanning instead.

More details here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants