Home > Mobile >  Flutter errors when adding firebase auth and core
Flutter errors when adding firebase auth and core

Time:03-12

I am doing a chat application in flutter. I am only at the beginning, trying to set up Firebase with Flutter.

When I add to my pubspec.yaml: (copied from pub.dev)

firebase_auth: ^3.3.10
firebase_core: ^1.13.1

I get for both my Android and iOS simulators errors. For android I have:

/Users/puskasimolaflora/AndroidStudioProjects/bsc/android/app/src/debug/AndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.google.firebase:firebase-analytics-ktx:20.1.0] /Users/puskasimolaflora/.gradle/caches/transforms-2/files-2.1/a328238d31bf521a00741e1d4b91c005/jetified-firebase-analytics-ktx-20.1.0/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.google.firebase.analytics.ktx" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.google.firebase:firebase-analytics-ktx:20.1.0] /Users/puskasimolaflora/.gradle/caches/transforms-2/files-2.1/a328238d31bf521a00741e1d4b91c005/jetified-firebase-analytics-ktx-20.1.0/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.google.firebase.analytics.ktx" to force usage (may lead to runtime failures)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 25s
Exception: Gradle task assembleDebug failed with exit code 1

and for iOS I get:

CocoaPods could not find compatible versions for pod "firebase_auth":
      In Podfile:
        firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)

    Specs satisfying the `firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)` dependency were found, but they required a higher minimum deployment target.

    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    <internal:kernel>:90:in `tap'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:682:in `attempt_to_activate'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/bin/pod:25:in `load'
    /opt/homebrew/Cellar/cocoapods/1.11.2_2/libexec/bin/pod:25:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 11 Pro Max.

I have already tried every solution I have found on these topics, still it is not running.

CodePudding user response:

for Android

uses-sdk:minSdkVersion 16 cannot be... minSdk version to at least 19,

in your build.gradle update your minsdk version to atleast 19

This is assuming you added firebase android dependencies.

in build.gradle

//if you are using crashlytics
       classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
//if you are using pref 
        classpath 'com.google.firebase:perf-plugin:1.4.0'
        classpath 'com.google.gms:google-services:4.3.10'

in app/build.gradle

dependencies {

...

implementation platform('com.google.firebase:firebase-bom:29.0.4')


    // Add the dependency for the Firebase SDK for Google Analytics
    // When using the BoM, don't specify versions in Firebase dependencies
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-perf'
}

apply plugins

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'

for IOS

in your Podfile change platform version from 9 to a higher value eg platform :ios, '12.0' if commented dont forget to uncomment.

If your build times are taking forever try using prebuilt firestore binary by adding this to your podfile

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.11.0'

  • Related