Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlutterFirebaseCorePlugin.java uses or overrides a deprecated API

Ok so I run my program without importing firebase core, firebase auth and cloud firestore, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_auth, Firebase_core and cloud_Firestore... I get the following error

Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. D8: Cannot fit requested classes in a single dex file (# methods: 89543 > 65536) com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:  The number of method references in a .dex file cannot exceed 64K. 

Please help me.

like image 653
Fred_Wolfe Avatar asked Jan 23 '21 18:01

Fred_Wolfe


People also ask

How do you fix uses or overrides a deprecated API?

How to resolve warning message: uses or overrides a deprecated api. You can resolve this warning message by using recommned API. In our example, we should use setVisible(true) rather than show() method.

What is deprecated API in Java?

A deprecated API is one that you are no longer recommended to use, due to changes in the API. While deprecated classes, methods, and fields are still implemented, they may be removed in future implementations, so you should not use them in new code, and if possible rewrite old code not to use them.

What is FlutterFire?

FlutterFire is a set of Flutter plugins which connect your Flutter application to Firebase.


1 Answers

I was having the same problem today and I found the solution here on Github

First, get the latest versions of your dependencies from pub.dev

Current latest versions are these:

  1. firebase_auth: ^0.20.0+1
  2. firebase_core: ^0.7.0

Then run these 3 commands in the terminal:

$ flutter pub upgrade  $ flutter pub get  $ flutter clean 

And then run your project

$ flutter run 

This will hopefully help you.

like image 85
Muhammad Sarib Avatar answered Sep 25 '22 20:09

Muhammad Sarib