I just installed flutter with firebase but when adding to database I get the following error
İnstalled Google Play Services
Add in AndroidManifest(main)
-Add in AndroidManifest(user)
Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/DynamiteModule(10303): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(10303): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
main.dart
import ‘package:cloud_firestore/cloud_firestore.dart’;
import ‘package:firebase_core/firebase_core.dart’;
import ‘package:flutter/material.dart’;
import ‘firebase_options.dart’;
Future
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.android,
);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Iskele(),
);
}
}
class Iskele extends StatefulWidget {
const Iskele({Key? key}) : super(key: key);
@override
State
}
class _IskeleState extends State
TextEditingController t1 = TextEditingController();
TextEditingController t2 = TextEditingController();
contentAdd() {
FirebaseFirestore.instance.collection(‘contents’).doc(“newcontent”).set({
‘title’: t1.text,
‘content’: t2.text,
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
margin: EdgeInsets.all(30),
child: Center(child: Column(mainAxisAlignment: MainAxisAlignment.center,children: [
TextField(controller: t1,),
TextField(controller: t2,),
Row(mainAxisAlignment: MainAxisAlignment.center,children: [
ElevatedButton(onPressed: contentAdd, child: Text(“Add”)),
],)
],),),
),
);
}
}
pubspec.yaml
name: hadihayirlisi
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: ‘none’ # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying –build-name and –build-number, respectively.
# In Android, build-name is used as versionName while build-number used as 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 is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: ‘>=2.18.0 <3.0.0'# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
cloud_firestore: ^3.4.7
firebase_core: ^1.22.0
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.2dev_dependencies:
flutter_test:
sdk: flutter# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0# 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 packages.
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# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg# 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: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packagesbuildGrade(Project)
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.13'
}
}allprojects {
repositories {
google()
mavenCentral()
}
}rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}task clean(type: Delete) {
delete rootProject.buildDir
}buildGrade(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 plugin: ‘com.google.gms.google-services’
apply from: “$flutterRoot/packages/flutter_tools/gradle/flutter.gradle”
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = ‘1.8’
}
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.hadihayirlisi”
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
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 platform(‘com.google.firebase:firebase-bom:30.2.0’)
implementation ‘com.google.firebase:firebase-analytics’
}
Okay, the error \”No acceptable module com.google.android.gms.providerinstaller.dynamite found\” usually indicates an issue with Google Play Services on the device or emulator you\’re using. It often means the Play Services version is outdated or not correctly installed. Here\’s a comprehensive approach to resolve this, combining the steps you\’ve already taken with additional checks and solutions:\n\n**Best Answer:**\n\nThe error `Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found` indicates an issue with Google Play Services not being up-to-date on your device or emulator. Here\’s a step-by-step solution to resolve this:\n\n**1. Google Play Services Version and Updates (Most Common Solution):**\n\n * **Emulator:** If you\’re using an emulator, make sure you\’re using an emulator image that includes the Google Play Store. AVD images labeled \”Google Play\” in Android Studio\’s AVD Manager are the correct ones. Create a new emulator instance if necessary. After creating the emulator, open the Play Store app on the emulator and check for updates to Google Play Services. This is crucial, as emulators don\’t always have the latest version automatically.\n * **Physical Device:** On your physical Android device, go to the Google Play Store app. Search for \”Google Play Services.\” If there\’s an \”Update\” button, tap it to update to the latest version. Reboot your device after the update.\n\n**2. Gradle Configuration (Verify and Update):**\n\n * **`build.gradle (Project)`:**\n\n “`gradle\n buildscript {\n ext.kotlin_version = \’1.6.10\’ // Or latest Kotlin version\n repositories {\n google()\n mavenCentral()\n }\n dependencies {\n classpath \’com.android.tools.build:gradle:7.1.2\’ // Or latest Gradle version\n classpath \”org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\”\n classpath \’com.google.gms:google-services:4.3.13\’ // Or latest google-services version\n }\n }\n\n allprojects {\n repositories {\n google()\n mavenCentral()\n }\n }\n “`\n\n * **`build.gradle (app)`:**\n\n “`gradle\n plugins {\n id \’com.android.application\’\n id \’kotlin-android\’\n id \’com.google.gms.google-services\’\n }\n\n android {\n compileSdkVersion 33 // Use the highest SDK version you have installed\n ndkVersion flutter.ndkVersion\n\n defaultConfig {\n applicationId \”com.example.hadihayirlisi\”\n minSdkVersion 21\n targetSdkVersion 33 // Should match compileSdkVersion\n versionCode flutterVersionCode.toInteger()\n versionName flutterVersionName\n }\n\n buildTypes {\n release {\n signingConfig signingConfigs.debug // Replace with your release signing config\n }\n }\n compileOptions {\n sourceCompatibility JavaVersion.VERSION_1_8\n targetCompatibility JavaVersion.VERSION_1_8\n }\n kotlinOptions {\n jvmTarget = \’1.8\’\n }\n }\n\n dependencies {\n implementation \”org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version\”\n implementation platform(\’com.google.firebase:firebase-bom:30.2.0\’) // Or latest Firebase BOM version\n implementation \’com.google.firebase:firebase-analytics\’\n }\n “`\n\n **Important Gradle Notes:**\n\n * **`compileSdkVersion` and `targetSdkVersion`:** Make sure these are set to the highest SDK version you have installed in your Android SDK Manager. Having a large discrepancy between these and the support library versions can cause issues.\n * **Firebase BOM (Bill of Materials):** Using the Firebase BOM (`platform(\’com.google.firebase:firebase-bom:…\’)`) is highly recommended. It manages the versions of all your Firebase dependencies, preventing conflicts. Use the *latest* BOM version.\n * **google-services plugin:** Ensure the `com.google.gms.google-services` plugin is declared in both the project-level and app-level `build.gradle` files. It\’s essential for Firebase integration.\n * **Kotlin Version:** Keep your Kotlin version up to date.\n * **Gradle Version:** Ensure your Gradle version is compatible with your Android Gradle Plugin version.\n * **Repositories:** Double-check that `google()` and `mavenCentral()` are included in both `buildscript { repositories { … } }` and `allprojects { repositories { … } }`.\n\n**3. Clean and Rebuild:**\n\n * In Android Studio, go to `Build` -> `Clean Project`.\n * Then, go to `Build` -> `Rebuild Project`.\n * Invalidate Caches and Restart: File -> Invalidate Caches / Restart… -> Invalidate and Restart\n\n**4. Flutter Clean:**\n\n * Open a terminal in your Flutter project directory and run: `flutter clean`\n * Then, run `flutter pub get` to re-fetch dependencies.\n\n**5. Check Firebase Core Version:**\n\n * Ensure your `firebase_core` version in `pubspec.yaml` is compatible with other Firebase packages.\n * Consider upgrading if it\’s significantly behind.\n\n**6. AndroidManifest.xml (Verify, though less likely to be the cause):**\n\n While the error isn\’t directly related to manifest entries, double-check that you have the necessary permissions:\n\n “`xml\n