Home > database >  My Flutter App is not running after adding cloud_firebase package
My Flutter App is not running after adding cloud_firebase package

Time:11-25

Recently I have added firebase to my flutter project. To use firebase database services I have added cloud_firebase package. But after adding this package my app is not running and giving me an exception:

BUILD FAILED in 31s
The plugin cloud_firestore requires a higher Android SDK version.
Fix this issue by adding the following to the file C:\Users\Jaguar\Desktop\AppDevelopment\acadmt\android\app\build.gradle:
android {
  defaultConfig {
    minSdkVersion 19
  }
}
Note that your app won't be available to users running Android SDKs below 19.
Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.
Exception: Gradle task assembleDebug failed with exit code 1

The exception message is also suggesting following suggestions:

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="io.flutter.plugins.firebase.firestore" to force usage (may lead to runtime failures)

I have tried the first two suggestions but still, the app is not working.

CodePudding user response:

Go to this path :

C:\Users\Jaguar\Desktop\AppDevelopment\acadmt\android\app\build.gradle

android {
  defaultConfig {
    minSdkVersion 19
  }
}

change your minSdkVersion to 30

that is:

android {
  defaultConfig {
    minSdkVersion 30
  }
}

CodePudding user response:

You may not apply changes after editing minSdkVersion

to solve this problem:

1-open build.gradle file and edit it:

android {
  defaultConfig {
    minSdkVersion 19
  }
}

then on right side of android studio,make sure to select open for editing in android studio to apply changes and syncing gradle for new changes.

2-make a clean (File>invalidate Caches/Restart)

  • Related