today I was learning firebase and I got stuck while running the app.
following is the error that I got when I build the app after changes -:
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_core:javaPreCompileDebug'.
> Could not resolve all files for configuration ':firebase_core:debugCompileClasspath'.
> Could not find auto-value-annotations.jar (com.google.auto.value:auto-value-annotations:1.6.5).
Searched in the following locations:
https://jcenter.bintray.com/com/google/auto/value/auto-value-annotations/1.6.5/auto-value-annotations-1.6.5.jar
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
below are the file where I made changes and I assume that I did correctly as I am new to firebase and flutter -: App\build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flashchat"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
and below is the android\build.gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
please help me with this...
below is the pubspec.yaml file
name: flashchat
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.1
firebase_core: ^0.5.3
firebase_auth: ^0.18.4
cloud_firestore: ^0.14.4
animated_text_kit: ^2.5.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/flash.png
- images/flash1.png
try to add this
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.game_app"
minSdkVersion 21
targetSdkVersion 30
multiDexEnabled true - !!!add this line
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
and also add multiDexEnabled imlimentation
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.android.support:multidex:1.0.3' // add this line
}
Related
hei im new on firebase flutter, and i want to make login page with auth with firebase. and after i make login page and all setup fromo documentation for firebase to my project i get this erorr.
I try pub clear cache and its not solving the problem.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':firebase_core:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':firebase_core:debugCompileClasspath'.
> Could not find com.google.firebase:firebase-common:.
Required by:
project :firebase_core
* 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 16s
Exception: Gradle task assembleDebug failed with exit code 1
* 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 16s
Exception: Gradle task assembleDebug failed with exit code 1
this is my pubspec.yaml with the latest version firebase
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
google_fonts: ^1.1.0
flutter_svg: ^0.18.0
animate_icons: ^1.0.0
motion_tab_bar: ^0.1.5
simple_animations: ^1.3.3
#firebase
firebase_core: ^0.7.0
firebase_analytics: ^7.0.1
firebase_auth: ^0.20.1
cloud_firestore: ^0.16.0+1
provider: ^4.3.3
dev_dependencies:
flutter_test:
sdk: flutter
app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
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' // Google Services plugin
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "id.skyward.plantgo"
minSdkVersion 23
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
}
debug {
minifyEnabled true
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.5.0')
// 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'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
}
rootProject.ext {
set('FlutterFire', [
FirebaseSDKVersion: '25.12.0'
])
}
build.gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5' // Google Services plugin
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have updated your app/build.gradle file please try this.
I have just add one line implementation 'com.google.firebase:firebase-core:17.0.1'.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
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' // Google Services plugin
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "id.skyward.plantgo"
minSdkVersion 23
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
}
debug {
minifyEnabled true
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.5.0')
// 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'
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-core:17.0.1'
}
rootProject.ext {
set('FlutterFire', [
FirebaseSDKVersion: '25.12.0'
])
}
UPDATE
I found the answer for this. at the app/build.gradlefiles, this line FirebaseSDKVersion: '25.12.0' is the problem.
Its should be same version with implementation platform('com.google.firebase:firebase-bom:26.5.0')
so i change to FirebaseSDKVersion: '25.12.0' then firebase core its work.
So I was just trying to implement google sign in feature in my app when I encountered this error
Here is the entire text:
FAILURE: Build failed with an exception.
* Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 362
* What went wrong:
A problem occurred configuring project ':firebase_auth_web'.
> Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1
Things I have done:-
1.I have already added required plug ins in dependencies
dependencies:
google_sign_in: ^4.5.3
firebase_auth: ^0.18.0+1
2.My flutter is up to date .
My android/build.gradle file
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My app/build.gradle file
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.memesgram23"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:17.5.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
Stackoverflow is telling me that the post has mostly code so I am adding this line so that is balances out.I don't know what details I could add I think stackoverflow should so something about this algorithm .
Upgrade the minSdkVersion to the following:
minSdkVersion 23
Also add firebase_core to pubspec.yaml file:
firebase_core: ^0.5.0
I am currently trying to integrate Firebase Messaging into my project, I have set up a firebase project and successfully imported all of the other dependencies I need (crashlytics, firestore etc...)
however when I add the firebase messaging dependency to my pubspec.yaml I get an error when building. I am using the newest version of firebase_messaging and also the newest version of google services.
The Error:
Plugin project: firebase_core_web not found. Please update settings.gradle.
Invalid depfile: C:\Users\Owner\AndroidStudioProjects\switcheroo_ios\.dart_tool\flutter_build\d71b8b11f916190e0bd095c78ccf0a69\kernel_snapshot.d
Invalid depfile: C:\Users\Owner\AndroidStudioProjects\switcheroo_ios\.dart_tool\flutter_build\d71b8b11f916190e0bd095c78ccf0a69\kernel_snapshot.d
AGPBI: {"kind":"error","text":"Type com.google.firebase.iid.zzbb is referenced as an interface from `com.google.firebase.messaging.zzf`.","sources":[{}],"tool":"D8"}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform artifact 'firebase-messaging.aar (com.google.firebase:firebase-messaging:20.0.1)' to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21}.
> Execution failed for DexingWithClasspathTransform: C:\Users\Owner\.gradle\caches\transforms-2\files-2.1\ac2c922e894bed89371853ed7d90bb4e\jetified-firebase-messaging-20.0.1\jars\classes.jar.
> Error while dexing.
App Gradle:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
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'
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.barbecu.switcherooIOS"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-crashlytics:17.0.1'
}
Project Gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Try adding
implementation 'com.google.firebase:firebase-messaging:20.0.1'
inside dependencies
just try adding dependencies that r related to each platform explicitly like in android as above
for ios (im not sure about ios ecosystem) but adding this might help
pod 'Firebase/Messaging'
1.- In build.gradle (project level) use:
classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
2.- In build.gradle (app level) use:
minSdkVersion 21
3.- Replace settings.gradle content with the solution provided here:
Plugin project :firebase_core_web not found
I am getting a google play services error in android studio and i am using flutter. I have tried various solutions but nothing seems to work.
I have tried to change the version of googleplayservices but its the same.
Failed to capture fingerprint of input files for task
':app:checkDebugClasspath' property 'compileClasspath' during up-to-date
check.
> In project 'app' a resolved Google Play services library dependency
depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the
library will be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1 ->
com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or have
transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends on project 'firebase_auth' which depends onto
com.google.firebase:firebase-auth#16.0.2
-- Project 'app' depends on project 'firebase_core' which depends onto
com.google.firebase:firebase-core#16.0.4
-- Project 'app' depends on project 'cloud_firestore' which depends onto
com.google.firebase:firebase-firestore#17.1.1
-- Project 'app' depends on project 'firebase_storage' which depends onto
com.google.firebase:firebase-storage#15.+
-- Project 'app' depends on project 'google_sign_in' which depends onto
com.google.android.gms:play-services-auth#16.0.1
For extended debugging info execute Gradle from the command line with
./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-
services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding
"googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
build.gradle(app)
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with
flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.news"
minSdkVersion 16
multiDexEnabled true
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release`
works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
build.gradle/project
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
ext {
global_version_firebase = '16.0.+'
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
pubspec.yaml
name: news
description: 'A new Flutter application.'
version: 1.0.0+1
environment:
sdk: '>=2.0.0-dev.68.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: null
share: null
connectivity:
url_launcher:
cloud_firestore:
rxdart:
firebase_auth: ^0.5.19
google_sign_in:
date_format:
intl:
firebase_storage: ^0.3.7
image_picker:
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/logo.jpg
- images/fb.jpg
- images/back.jpg
- images/google.jpg
please help me to solve this error.
Thank you
the issue actually stems from this one dependency here:
Project 'app' depends on project 'firebase_storage' which depends onto
com.google.firebase:firebase-storage#15.+
this means, that pubspec.yaml needs this one dependency updated:
firebase_storage: ^1.0.4
as the documentation states for 1.0.4 from Oct 12, 2018 bump Android dependencies to latest.
I want to implement Firebase Cloud Messaging into my Flutter application and i started to implement the Android part. I added the dependencies just like in the Firebase documentation, but now I'm getting gradle error when building my app:
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[16.0.0,16.0.0]], but resolves to 15.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
I'm not experienced at all with gradle, so I would appreciate some help^^
Here is app/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.leodr.pguapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
And here is the project build.gradle(if needed):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Downgrade the gms version on your build.gradle to
classpath 'com.google.gms:google-services:3.2.1'
write this at the bottom of app.gradle com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
hello I had the same problem but I fixed it by adding in buil.gradle, I hope and solve it
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
}
I think, when you don't have latest version of GRADLE/SDK/ANDROID STUDIO and you use the latest firebase supports version then this type of error may be generate.
So for the solution you have to decrease the gms version to run with your SDK compatible versoin.