Issue occurs while build apk in flutter - firebase

This kind of error occurs, dom 25.12.0 not present on that location, and annotation did not change after changing its version.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateReleaseRFile'.
> Could not resolve all files for configuration ':releaseRuntimeClasspath'.
> Could not find com.google.firebase:firebase-bom:25.12.0.
Searched in the following locations:
- https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-
bom/25.12.0/firebase-bom-25.12.0.pom
- https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-
bom/25.12.0/firebase-bom-25.12.0.jar
Required by:
project :
> Could not find com.google.firebase:firebase-core:.
Required by:
project :
> Could not find androidx.annotation:annotation:1.1.0.
Searched in the following locations:
-
https://storage.googleapis.com/download.flutter.io/androidx/annotation/annotation/1.1.0/annotation-
1.1.0.pom
-
https://storage.googleapis.com/download.flutter.io/androidx/annotation/annotation/1.1.0/annotation-
1.1.0.jar
Required by:
project :
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':javaPreCompileRelease'.
> Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not find com.google.firebase:firebase-bom:25.12.0.
Required by:
project :
> Could not find com.google.firebase:firebase-core:.
Required by:
project :
> Could not find androidx.annotation:annotation:1.1.0.
Required by:
project :
* 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 11s
The plugin firebase_core could not be built due to the issue above.
my pubspec.yml file:-
name: Dreamcart
description: A new Flutter application.
version: 2.1.0
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.0
cached_network_image: 2.2.0
fluttertoast: ^6.0.1
flutter_staggered_grid_view: 0.3.0
flutter_launcher_icons: ^0.8.0
mvc_pattern: ^3.4.1
global_configuration: ^1.3.0
http: ^0.12.0+2
intl: any
html: ^0.14.0+2
shared_preferences: ^0.5.3+4
flutter_html: ^0.10.4
flutter_svg: ^0.19.0
location: ^2.3.5
dynamic_theme: ^1.0.0
flutter_inappbrowser: ^1.2.2
url_launcher: ^5.4.1
firebase_messaging: ^7.0.0
firebase_analytics: ^4.0.2
razorpay_flutter: ^1.2.1
otp_screen: ^0.0.3
marquee: ^1.7.0
keyboard_actions: ^1.0.4
keyboard_avoider: ^0.1.2
flutter_typeahead: ^2.0.0
carousel_slider: ^3.0.0
speech_recognition: ^0.3.0+1
permission_handler: ^4.2.0
firebase_core: ^0.5.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_icons:
image_path: "assets/img/Dreamcartlogo.png"
android: "launcher_icon"
flutter:
assets:
- assets/cfg/
- assets/img/
- assets/img/visa.png
- assets/img/paypal.png
- assets/img/paypal2.png
- assets/img/apple_pay.png
- assets/img/brazil.png
- assets/img/canada.png
- assets/img/china.png
- assets/img/france.png
- assets/img/germany.png
- assets/img/italy.png
- assets/img/netherlands.png
- assets/img/spain.png
- assets/img/united-arab-emirates.png
- assets/img/united-states-of-america.png
- assets/img/marker.png
- assets/img/my_marker.png
- assets/img/mastercard.png
- assets/img/visacard.png
- assets/img/wallet.png
- assets/img/cash.png
- assets/img/pay_pickup.png
- assets/img/logo.png
- assets/img/loading.gif
- assets/img/loading_card.gif
- assets/img/loading_trend.gif
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Poppins
fonts:
- asset: assets/fonts/Poppins-Thin.ttf
weight: 100
- asset: assets/fonts/Poppins-ExtraLight.ttf
weight: 200
- asset: assets/fonts/Poppins-Light.ttf
weight: 300
- asset: assets/fonts/Poppins-Regular.ttf
weight: 400
- asset: assets/fonts/Poppins-Medium.ttf
weight: 500
- asset: assets/fonts/Poppins-SemiBold.ttf
weight: 600
- asset: assets/fonts/Poppins-Bold.ttf
weight: 700
- asset: assets/fonts/Poppins-ExtraBold.ttf
weight: 800
- asset: assets/fonts/Poppins-Black.ttf
weight: 900
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 = '9'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '2.1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 30
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.portalperfect.dreamcart"
minSdkVersion 19
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
minifyEnabled true
useProguard true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
configurations.all {
resolutionStrategy {
force 'androidx.annotation:annotation:1.1.0'
}
}
dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.android.gms:play-services-base:15.0.2'
implementation "com.google.firebase:firebase-core:17.5.1"
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:multidex:1.0.3'
// Add the Firebase Crashlytics SDK.
}
apply plugin: 'com.google.gms.google-services'
android/build.gradle :-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
center()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried so much but no solutions found for this issue. Help me out. Thank You.

Don't mention the version of firebase plugins or use updated version

Related

Included Firebase in flutter and got errors while building (warning i had pasted all the error code i got so please be calm)

I am trying to do a chat app and I included the
Firebase core, firebase auth and Firebase firestore.
When I run the app it shows the following errors. Do I need to post any other code files?
D8: Cannot fit requested classes in a single dex file (# methods: 91691 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:132)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:119)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:432)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:242)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:57)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:67)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:63)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:63)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:60)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:200)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
at Version.fakeStackEntry(Version_2.1.62.java:0)
at com.android.tools.r8.utils.Y.a(SourceFile:78)
at com.android.tools.r8.D8.run(D8.java:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:117)
... 36 more
Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 91691 > 65536)
at com.android.tools.r8.utils.T0.error(SourceFile:1)
at com.android.tools.r8.utils.T0.a(SourceFile:2)
at com.android.tools.r8.dex.P.a(SourceFile:740)
at com.android.tools.r8.dex.P$h.a(SourceFile:7)
at com.android.tools.r8.dex.b.a(SourceFile:14)
at com.android.tools.r8.dex.b.b(SourceFile:25)
at com.android.tools.r8.D8.d(D8.java:133)
at com.android.tools.r8.D8.b(D8.java:1)
at com.android.tools.r8.utils.Y.a(SourceFile:36)
... 38 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
* 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 34s
[!] The shrinker may have failed to optimize the Java bytecode.
To disable the shrinker, pass the `--no-shrink` flag to this command.
To learn more, see: https://developer.android.com/studio/build/shrink-code
Exception: Gradle task assembleDebug failed with exit code 1
This is my pubspec.yml file where i included the dependencies in of the Firebase core,Firebase auth and Firebase firestore and others that are need for the project
name: flash_chat
description: A new Flutter project.
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.2
animated_text_kit: ^4.2.1
cloud_firestore: ^1.0.7
firebase_auth: ^1.1.2
firebase_core: ^1.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
This is a multidex issue, you have two solution, or you can set the minSDKVersion to 21 or add multidex in your dependencies in build.gradle:
https://developer.android.com/studio/build/multidex
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
Or just:
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
}
...
}
Add Multi Dex :
Here is the Code : Go to Android->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"
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.bahokboy"
minSdkVersion 16
targetSdkVersion 30
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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
}

Firebase Erorr on Flutter: Could not resolve all task dependencies for configuration ':firebase_core:debugCompileClasspath'

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.

firebase, flutter error 'Could not resolve all files for configuration'

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
}

Firebase_database plugin for flutter is not working (resolve android.arch.core:common:1.1.1.)

I am new to flutter development. I want to use the firebase database. I was able to connect to firebase using the firebase analytics plugin but I was not successful in using the firebase database.
I tried to add the plugin on a time to knew where did the issue come from and know I am sure it is the firebase_database plugin.
I have successfully added the following package:
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
firebase_auth: ^0.14.0+5
but when I add
firebase_database: ^3.1.0
I get the below error
Finished with error: Gradle task assembleDebug failed with exit code 1
This error appears when I run the default flutter application (The counter app) on my Android mobile.
So I open the Android module in Android Studio to get more details about the error.
I got the following error
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.lifecycle:runtime:1.1.1.
Show Details
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.lifecycle:common:1.1.1.
Show Details
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.lifecycle:runtime:{strictly 1.0.0}.
Show Details
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.lifecycle:common:{strictly 1.0.0}.
Show Details
Affected Modules: firebase_database
ERROR: Failed to resolve: com.google.firebase:firebase-common:16.0.6
Show in Project Structure dialog
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.core:common:{strictly 1.0.0}.
Show Details
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.core:common:1.1.1.
Show Details
Affected Modules: firebase_database
ERROR: Unable to resolve dependency for ':firebase_database#debug/compileClasspath': Could not resolve android.arch.lifecycle:runtime:1.0.0.
Show Details
Affected Modules: firebase_database
This is my pubspec.yaml file
version: 1.0.0+1
environment:
sdk: ">=2.1.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: ^0.1.2
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
firebase_auth: ^0.14.0+5
firebase_database: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
Also, below is my project level my build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
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
}
Below is my app level 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"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.labstabs.riskometer"
minSdkVersion 21
targetSdkVersion 28
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 {
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'
}
apply plugin: 'com.google.gms.google-services'
replace with this
classpath 'com.google.gms:google-services:4.2.0'

How to solve gradle googleplayservices version error in flutter?

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.

Resources