Execution failed for task ':app:checkDebugAarMetadata - flutter

What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.work:work-runtime:2.7.0-rc01.
AAR metadata file: C:\Users\100812.gradle\caches\transforms-2\files-2.1\8fcba37f766c3622d8dbd30df4e98577\work-runtime-2.7.0-rc01\META-INF\com\android\build\gradle\aar-metadata.properties.

you can find the compileSdkVersion under: android > app > build.gradle
android {
compileSdkVersion 31
...
}

Check with your configuration in android/app/src/build.gradle file
with new version of flutter compileSdk and targetSdkVersion are mention as below
android {
compileSdkVersion flutter.compileSdkVersion
.....
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

I had faced the same issue, In case you cloned a GitHub repository and then when you run that code this is the error that comes up(as it happened with me) then Solution :
Step 1 : Create a new flutter project at your local system
Step 2 : Copy the code given in main.dart file of stub project and paste it into main.dart file of your local project
Step 3 : Make an 'assets' folder in your local project
Step 4 : download asset-files from GitHub and put them into your local 'assets' folder
Step 5 : in your local pubspec.yaml file, add dependency for your 'assets' folder
Step 6 : Rename MyApp() in widget testing file to MaterialApp()
Hit save(in files other than pubspec.yaml), get all dependencies(in pubspec.yaml) and you're good to go
In short :
Copy the required code and the dependencies you want
Then Save the changes and run
Error was there in my case mainly because the Flutter V2 has many changes and the code was outdated.

Go to android/app/build.gradle
Change:
From: compileSdkVersion 29
To: compileSdkVersion 31

Please run, then press f you will notice the SDK is the wrong version.
npx react-native doctor

Related

Playing video on flutter app on android using better_player is causing this error

Non-fatal Exception:
io.flutter.plugins.firebase.crashlytics.FlutterError:
PlatformException(error,
MediaSource.Factory#setDrmSessionManagerProvider no longer handles
null by instantiating a new DefaultDrmSessionManagerProvider.
Explicitly construct and pass an instance in order to retain the old
behavior., null, java.lang.NullPointerException:
MediaSource.Factory#setDrmSessionManagerProvider no longer handles
null by instantiating a new DefaultDrmSessionManagerProvider.
Explicitly construct and pass an instance in order to retain the old
behavior.
It was working previously but now it's failing due to exoPlayer. Any idea how to fix this?
it happened when i added another audio package to pubpsec.yaml so i removed last added audio package and run flutter clean then it worked fine again
for the Android error, it tells you that you need to enable multiDex in your project, here is how
in android/app/build.gradle add this line multiDexEnabled = true in the defaultConfig
your defaultConfig should look something like this
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.test.test"
minSdkVersion 21
targetSdkVersion 30
multiDexEnabled = true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
regarding the iOS error it says
dependency were found, but they required a higher minimum deployment target.
so increase the minimum deployment target. you can find it in ios/flutter/AppFrameworkInfo.plist named MinimumOSVersion and looking like this
<key>MinimumOSVersion</key>
<string>9.0</string>

Flutter MainActivity is defined multiple times error after upgrade [duplicate]

I'm using Android Studio for the first time and I got the following error after importing the project (previously it was an eclipse project where I had issues too.)
Here is the information given:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/crash-id/Development/SDK/adt-bundle-linux-x86_64-20140702/sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/dex/debug --input-list=/home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/crash-id/Development/SDK/adt-bundle-linux-x86_64-20140702/sdk/build-tools/21.1.2/dx --dex --no-optimize --output /home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/dex/debug --input-list=/home/crash-id/AndroidstudioProjects/LocalSin/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The app build.gradle is this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.myapp.test"
minSdkVersion 11
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-play-services.jar')
compile files('libs/httpcore-4.3.2.jar')
compile files('libs/httpmime-4.3.4.jar')
}
And the project built.gradle is this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Do you have any idea what the problem could be and how can it be solved? A good explanation for the problem would be useful too as I am new to Android Studio. Thanks in advance :)
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-play-services.jar')
I think you should remove 1 of those lines.
cd android/ && ./gradlew clean && cd .. && react-native run-android
I had the Android Studio Error:Execution failed for task ':app:dexDebug' that i solve it by setting multiDexEnabled to true
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Too many library were used in my project so i exceed the 65K methods dex limit imposed by Android for more information see : http://developer.android.com/tools/building/multidex.html
This happens because you are duplicating the library dependency inside of app build.gradle in android studio.
Android Studio automatically adds the dependencies for all the files in the libs folder by using
compile fileTree(dir: 'libs', include: ['*.jar'])
or in your specific case the dependency is added using
compile files('libs/google-play-services.jar')
^ Now when you try to add the dependency again by using
compile 'com.google.android.gms:play-services:+'
you get the error.
SOLUTION
Remove all duplicate dependencies added inside the "app build.gradle" and you should be good to go.In your case remove
compile 'com.google.android.gms:play-services:+'
avoid to include whole gms library:
compile 'com.google.android.gms:play-services:+'
Instead, just use required components in this way:
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
Ensure that the Package names are not duplicated across the projects being compiled
In #Drivers' answer, it is pointed out that in a given project, there should not be multiple dependencies that have the same namespace. In the case above, the Google Play Services library had been included twice, and thus caused a package name conflict.
The same can also happen across multiple modules (apps, libraries etc.) in the same project. So, ensure that for each AndroidManifest.xml file, the package name is unique across all modules:-
AndroidManifest.xml:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="this.must.be.unique.across.modules">
I had the below code on gradle file and same error.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
}
dependencies {
compile 'com.android.support:design:23.+'
}
dependencies {
compile 'com.android.support:design:23.+'
}
dependencies {
compile 'com.android.support:design:23.+'
}
Removed those last 3 dependencies and now its working!
delete all files in c:\users\<username>\.gradle\caches\transforms-2\files-2.1\
Enjoy the command flutter run

Execution failed for task 'processReleaseGoogleService' No matching client found for package name [duplicate]

I want to implement push notification.
I added to project level:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
and to app level:(at the bottom of the file)
....
compile 'com.squareup.okhttp3:okhttp:3.3.0'
}
apply plugin: 'com.google.gms.google-services'
Then I added google-services.json file to project in app level
But, when I syncro gradle, it launch the error:
No matching client found for package name "...."
In gradle I have 2 different build variants , and look like:
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.xxx.awsomeapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".realm.XXXXXX"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher_chv"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
And finally the gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
mavenCentral()
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
productFlavors {
vanilla {
applicationId "es.xxx.awsomeApp"
resValue 'string', 'app_name', "Awsome"
}
chv {
applicationId "es.xxx.awsomeApp.chv"
resValue 'string', 'app_name', "Awsome CHV"
signingConfig signingConfigs.chv_release
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Auxiliar libraries
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-beta2'
//Auxiliar libraries
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-beta2'
compile 'org.igniterealtime.smack:smack-tcp:4.2.0-beta2'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta2'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.orhanobut:logger:1.15'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.Slyce-Inc:SlyceMessaging:1.1.2'
compile 'io.realm:android-adapters:1.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.rengwuxian.materialedittext:library:1.8.3'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.3.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'org.igniterealtime.smack:smack-tcp:4.2.0-beta2'
testCompile 'com.android.support.constraint:constraint-layout:1.0.0-beta2'
testCompile 'com.android.support:design:24.2.1'
testCompile 'com.orhanobut:logger:1.15'
testCompile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
testCompile 'com.github.Slyce-Inc:SlyceMessaging:1.1.2'
}
apply plugin: 'com.google.gms.google-services'
And the firebase console.
How can I solve it?
Note, that json files are each one of their project.
Just go to the google-services.json
change the package-name to the name of your package
{
"client_info": {
"mobilesdk_app_id": "1:113908578702:android:a0a98decfd9f22466f4cdf",
"android_client_info": {
"package_name": "com.example.Appname"
}
}
}
sync your project, it'll be solved
I was facing the same error. I am using multiple flavors. Therefore, I put the google-services.json in app/src/{flv} directory.
It worked well for one flavor but did not work for others. The issue was that I have also placed google-services.json corresponding to flavor for which it was working in app directory also.
Google will search for sub-directories / flavor directories only if it did not find the google-services.json in the app directory.
So, make sure you don't put google-services.json in app directory in case you have separate google-services.json for multiple flavors.
Please see this article for mode details on Android product flavors.
I had the same problem, so using Android Studio 2.3.3 I used the menu
Tools> Firebase - on the right side of the window click Notifications and then Recieve notifications on your app,finally click Connect to Firebase, after this you will see a dialog saying This app is already connected to a project but just click Sync, then firebase will sync automatically all your app clients and it will fix this issue,by the way I know it's too late to respond but it might help someone.
If you have added google-service.json file
check build.gradle(: app) package_name and in google-service.json file package_name is the same
Also if you have added productFlavors make sure you have added that package in firebase for creating JSON file
Check your Gradle app level applicationId, it should be same as firebase package name, then it works like a charm
*Go to build.gradle and change the package name with same as AndroidManifest.xml and sync again *
[1][In this image show package name in AndroidManifest same as build.gradle]
[1]: https://i.stack.imgur.com/T4cqz.png
[Below image show package name in build.gradle same as AndroidManifest]
[2]: https://i.stack.imgur.com/ModHS.png
[package name in build.gradle][2]
Also check firebase and download recent .json file.
Update your applicationId inside defaultConfig of app level gradle file. With your package name.
Try to download the latest google-services.json file
it's a bit late, but maybe it could help someone like me with the same situation. I defined another app in the Firebase console at project settings with a different package name equal to my other flavor build. and then I downloaded the new google-services.json file and used it.it worked like a charm for me

Flutter crash on release start. E/LoadedApk: Unable to instantiate appComponentFactory, Didn't find class "com.example.androidx. 17_4_2020

I have upgraded my flutter to latest version 1.18.0-6.0.pre.65 • channel master
My app was working when released. but now, it is working in debug mode only.
and gives the error
E/LoadedApk: Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "com.example.androidx" on path: DexPathList[[zip file "/data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/lib/x86, /data/app/com.example-w8uMhpPeS9WD7rhvuuQjbg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
I have tried mostly all available solutions like:
1:invalidate cache,clean project,flutter clean,update,upgrade and rebuild
2: Add -keep class androidx.core.app.CoreComponentFactory { *; } to your proguard config so that this class won't be proguarded out
3- changed to stable channel with no luck.
4- Created new flutter project and released it, gives the same error.
My gradle:
android {
compileSdkVersion 'android-R'
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
buildToolsVersion = '30.0.0 rc2'
Solved!.
for anyone will face this problem, the problem is some package you use.
try run release on real device and check log for the name of library name.so and downgrade its version from its change log

App crashed after adding flutter firebase auth ui

Flutter firebase auth UI have some issue, because of firebase_auth version miss match issue
My flutter app crashed and unable to identify an issue, after opening in an android studio, I got the issue and it is here
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mycom.mypetshop. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##16.0.2:240)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin.<init>(FirebaseAuthPlugin.java:54)
at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin.registerWith(FirebaseAuthPlugin.java:47)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:20)
at com.vyapari2online.mypetshop.MainActivity.onCreate(MainActivity.java:11)
at android.app.Activity.performCreate(Activity.java:5990)
How to solve this?
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 '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.
#flutter_firebase_ui have a lot of issues #google please hire me, I can help your developers
Dependency Configuration
For the gradle issue, make sure your Android SDK and Firebase/Firestore plugins are compatible versions are compatible. Here's what worked for me:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-auth:16.0.5'
}
In the module/app build.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.timeswap.timeswapcore"
minSdkVersion 17
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
}
Specifically, pay attention to the compileSdkVersion, targetSdkVersion, and the version numbers of google-services and firebase_auth. Fiddling with those numbers eventually led me to this config, and it may help you find your appropriate config.
Firebase or Firestore Initialization
As for the App initialization, I have this
Firestore firestore = Firestore.instance;
firestore.settings(timestampsInSnapshotsEnabled: true);
in my _initFirestore, which is called right after super.initState()
#override
void initState() {
super.initState();
_initFirestore();
checkCurrentUser();
}
Firebase (and all other Firebase plugins that I've used) is initialized similarly, but with the firebase_core: dependency instead of cloud_firestore: in pubspec.yaml.
For instance, from the flutter/plugins/packages/firebase_storage GitHub repo:
void main() async {
final FirebaseApp app = await FirebaseApp.configure(
name: 'test',
options: FirebaseOptions(
googleAppID: Platform.isIOS
? '1:159623150305:ios:4a213ef3dbd8997b'
: '1:159623150305:android:ef48439a0cc0263d',
gcmSenderID: '159623150305',
apiKey: 'AIzaSyChk3KEG7QYrs4kQPLP1tjJNxBTbfCAdgg',
projectID: 'flutter-firebase-plugins',
),
);
final FirebaseStorage storage = FirebaseStorage(
app: app, storageBucket: 'gs://flutter-firebase-plugins.appspot.com');
runApp(MyApp(storage: storage));
}
You can also use this Medium post as a guide to get started with the flutter Firebase Auth UI.
For future reference, you can navigate to flutter/plugins/packages/{package name} on Github and find main.dart inside of examples/lib for a demo. Feel free to leverage this to solve your dependency issue as well!
You need to initialize the FirebaseApp before using it. You can add it to your onCreate method.
#Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
}
Also make sure you have the dependency in your build.gradle
dependencies {
....
}
apply plugin: 'com.google.gms.google-services'
I also face same issue and solved by adding Facebook app id in AndroidManifest.xml
Try run Android app with Android studio you will get the error message