Flutter issue with Google Ads & Firebase Versions - flutter

I am using latest version of flutter 3.7.2
My app has google ads and firebase dependency for which is use following pubs latest versions
admob_flutter:
firebase_messaging:
firebase_core:
Everthing is working perfect but when I have uploaded app on playstore it gives me following error
For solution of above warning i done the change in app level gradle file and following line
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-ads:21.5.0' // this line added for solution
implementation platform('com.google.firebase:firebase-bom:29.3.0')
implementation 'com.google.firebase:firebase-analytics'
}
but after adding above line my firebase stopped working it crash when run app with following error.
NOTE: I have tried flutter clean, reinstall app, flutter pub upgrade
everything is up-to date. Also when i change line implementation
'com.google.android.gms:play-services-ads:21.5.0' to implementation
'com.google.android.gms:play-services-ads:19.2.0' everything is
working perfect

you help me with the part that you say works with only 'com.google.android.gms:play-services-ads:19.2.0' and I had the same problem but trying to solve it by changing this line:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.google.firebase:firebase-ads:21.5.0'
}
you try to change firebase-ads:19.1.0 to 21.5.0 and it will let you use
implementation 'com.google.android.gms:play-services-ads:21.5.0'
It works for me, hope helps you.

If you are using 'admob_flutter' and update to 'com.google.android.gms:play-services-ads:2.50.0' you couldn't use Admob, this is because 'admob_flutter' does not support 'play-services-ads:2.50.0'.
In this case, I used 'google_mobile_ads 2.3.0' it's verified and published by 'google.dev
https://pub.dev/packages/google_mobile_ads

Related

java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient,

I can't run app on emulator/ real device.when i try to run app from vscode. it shows this error message. screenshot of debug console
i uninstall app and flutter clean.
UPDATE:
This error just happened to me when I launched the app in the store. I'm correcting it now, change the Location library to Gelocator.
At first I thought it was an error in Flutter 3.7.0, I lowered the version to 3.3.10 and 3.3.9 and the same problem continued. My solution was to change the location library to geolocator. It has almost the same functions, I only had to make a few changes.
https://pub.dev/packages/geolocator
No need to change the package I was also facing this issue I just fixed it:
Go into C:\Users\Qc\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle :
changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works
dependencies {
api '"com.google.android.gms:play-services-location:21.0.1'
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
List item In project at android level go into build.gradle and add this line:
in my case, got to C:\Users\Md Emarat Hossain\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\location-4.4.0\android\build.gradle and changed "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" works
I changed from "com.google.android.gms:play-services-location:16.+" to "com.google.android.gms:play-services-location:21.0.1" in my project this PATH
"C:\Users\chint\flutter.pub-cache\hosted\pub.dartlang.org\geolocator_android-4.1.7\android\build.gradle"

Flutter | Error: Couldn't resolve the package

I created a package that is a collection of my own helper classes for faster developing...
The package also included firebase_analytics: which requires a native implementation for each platform i want it to run. Even if i dont wanted to use firebase at all, but still wanted to use my package i was forced to create firebase-config files for the app, because the app crashes if the firebase_analytics package does not find a valid file for the specific platform. To avoid those things i splitted my package in two packages.
The Core-Package: All helper classes that run native dart code
Optional extension: Only the classes that need the firebase implementation
So if i want to use the package without firebase i just have to depend on the core.
If i want to use the firebase variant i could simply depend the firebase package, because the extension package itself depends on the core-package in its own pubspec.yaml file.
PROBLEM: Since i restructured my package like i described, all my apps that depend on it are not building anymore. The console says that all packages that i depend on in my two packages can not be found. This error occures both ways: With firebase & without.
ERROR: (Scroll down for the complete console output)
MY ATTEMPTS:
"flutter clean" & "flutter pub get" in every package and app folder
"flutter pub cache repair"
CORE-PACKAGE Pubspec.yaml:
FIREBASE-Extension Pubspec.yaml:
Plain Console Output:
pastebin.com/m14cbqDV
Thanks for any help!!
I am facing the same issue while i was making a build in Xcode 13.So I had upgraded my flutter version 2.8.0 to 2.10.2 and also removed the version of all firebase dependencies, then the issue was finally solved.
I have faced similar issues and resolved them by removing package versions. Issues like this often arise due to mismatched versions of packages (eg firebase_core, firebase analytics). Please try to remove versions of the firebase packages or the whole packages. (like firebase_analytics :).
Sorry, my bad! As you can see i moved my dependencys to the dev section of my pubspec.yaml. They should be placed in the dependency section.

How do you integrate a flutter plugin into an existing flutter project?

I want to install a simple audio recorder which will record a user’s voice. I know I can find plugins on PubDev, however I have difficulty in integrating them into my Flutter project. I have installed ‘audio_recorder 1.0.2. in a new dart file as part of ‘lib’. I don’t know how to integrate this file into the flutter project. I have tried to a button in another dart file which when pressed would take the user to that file, without succes. ‘This class is not a widget’ is the message I get. The ‘GitHub’ version has the errors ‘undefined class’, ‘LocalFileSystem isn’t defined for the type ‘AudioRecorder’. The example version (why this difference?) has quite a few errors after installation. Dependencies and imports are ok. When I install audio_recorder 1.0.2 inside the project via ‘Dart packages’ I get a lot of errors. I have successfully installed an audio recorder in another android app. I would like some help in how to integrate plugins in a flutter project.
The plugins have instructions on how to install it. Got to your pubspec.yaml-file and put it under dependencies.
Make sure that you add your dependency to pubspec.yaml like this:
dependencies:
audio_recorder: ^1.0.2
After that make sure to type "flutter pub get" in console.
Go on a specified file in which you want to use Your dependency and import it like this:
import 'package:audio_recorder/audio_recorder.dart';

Flutter Web cloud_firestore package: Versions newer than 0.12.11 produces just a blank web page

When I run the command: flutter build web => I get a blank web page. If I use cloud_firestore::0.12.11 OR older, all runs perfectly well.
Steps to reproduce the behavior:
flutter doctor. No issues found.
flutter run -d chrome. The app runs OK on the local browser.
flutter build web. The app runs and shows a blank page.
In pubspec.yaml: remove the dependency cloud_firestore: The app runs OK.
In pubspec.yaml: add the dependency cloud_firestore:0.12.11 (older version), The app runs OK.
Expected behavior
I need to use cloud_firestore: 0.14.0+2 so I can use the data type FirebaseFirestore.
Are you also using other firebase packages? I have found there are issues with firebase_auth - including a black screen.
Make sure you following the Migration Guide: https://firebase.flutter.dev/docs/migration/#plugin-changes
The issue was with a bug in the library itself.

How to use cloud_firestore in flutter for web and android?

I have a Flutter app which works on Android as expected but if I want to compile it for Web I get an error.
It has to do something with the dependency cloud_firestore. If I use the dependency firebase it works fine on the web but on android now not..
This is the error message I get using cloud_firestore (compiling for web):
Skipping compiling pay_balance|lib/main_web_entrypoint.dart with ddc because some of its
transitive libraries have sdk dependencies that not supported on this platform:
firebase_core|lib/firebase_core.dart
https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings
Can anybody help me? Maybe with another dependency for firestore (I did not find others which are working on web and android)..
Edit: I have used the firebase-dart plugin for web!! -> Only works on the web but not in android for me -> I need something for both at the same time!!
Or is there a Way I can use both packages without getting a compling error for the web when I import cloud_firestore?
If you want to use Firebase on Web and Mobile you have to get creative. I created the fb_auth plugin that uses the Mobile SDK firebase_auth on iOS and Android and the firebase package on web. This will give you a single plugin for auth.
https://pub.dev/packages/fb_auth
Im working on firstore and storage but they are not ready yet.
I have also created an article on how to do this with flutter:
https://medium.com/#rody.davis.jr/how-to-build-a-native-cross-platform-project-with-flutter-372b9e4b504f
You have to use dynamic imports so that at compile time it tree shakes what it doesn't need and will not throw an error.
Currently this is the only way to officially use both plugins in the same project.
EDIT: cloud_firestore now added
Two of the FutterFire plugins are now supported for web. FlutterFire plugins supporting web firebase_auth and firebase_core
cloud_firestore is now also supported