Warnings from the cloud_firestore plugin on Android: FirebaseCorePlugin.java uses unchecked or unsafe operations
Steps to Reproduce
- Create a new project
- Add dependency for
cloud_firestore: ^0.8.0 flutter run
Logs
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
And also
Note: /Users/filiph/dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/filiph/dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
(And also this, but it's covered by https://github.com/flutter/flutter/issues/18159)
W/Firestore( 5687): (0.6.6-dev) [Firestore]: The behavior for java.util.Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
W/Firestore( 5687): To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:
W/Firestore( 5687):
W/Firestore( 5687): FirebaseFirestore firestore = FirebaseFirestore.getInstance();
W/Firestore( 5687): FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
W/Firestore( 5687): .setTimestampsInSnapshotsEnabled(true)
W/Firestore( 5687): .build();
W/Firestore( 5687): firestore.setFirestoreSettings(settings);
W/Firestore( 5687):
W/Firestore( 5687): With this change, timestamps stored in Cloud Firestore will be read back as com.google.firebase.Timestamp objects instead of as system java.util.Date objects. So you will also need to update code expecting a java.util.Date to instead expect a Timestamp. For example:
W/Firestore( 5687):
W/Firestore( 5687): // Old:
W/Firestore( 5687): java.util.Date date = snapshot.getDate("created_at");
W/Firestore( 5687): // New:
W/Firestore( 5687): Timestamp timestamp = snapshot.getTimestamp("created_at");
W/Firestore( 5687): java.util.Date date = timestamp.toDate();
W/Firestore( 5687):
W/Firestore( 5687): Please audit all existing usages of java.util.Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you do not follow these steps, YOUR APP MAY BREAK.
cc @kroikie @bparrishMines
I'm not sure where to add this, but I'm having the same issue.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 123.8s (!)
Me too :(
Same issue with cloud_firestore: ^0.13.0+1. Not sure why this issue is closed.
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.0+1\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Still Facing this issue with cloud_firestore: ^0.13.0+1.
BUILD FAILED in 58s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Finished with error: The plugin cloud_firestore could not be built due to the issue above.
Same here
Problem persists on cloud_firestore: ^0.13.4
Me too, is there any update for this issue?
set: multiDexEnabled true solved for me.
project/android/app/build.gradle:
defaultConfig {
......
multiDexEnabled true
}
Problem persists on cloud_firestore-0.13.4+2
Persists on cloud_firestore: 0.13.5
flutter: ^1.12.13
multiDexEnabled true does not solve the problem for me.
Persists on cloud_firestore: ^0.13.5.
Also, why is this Closed when it's not been solved yet???
Same issue here,
Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.5\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
same issue happens with me Note: C:\flutter.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.13.5\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
same here, this annoying bug seems already here ages. tried anything I can find to solve it, but Nooooooooo....
Same problem with cloud_firestore: ^0.13.5
I have the same problem. I can create my app release apk but this doesn't work with Firebase. I have cloud_firestore: ^0.13.5
Note: /Users/erwinvasquezpinto/Programacion/Flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.5/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Removed unused resources: Binary resource data reduced from 338KB to 315KB: Removed 6%
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 75,2s
✓ Built build/app/outputs/apk/release/app-release.apk (21.0MB).
Doesn't work with Firebase.
I have cloud_firestore: ^0.13.5
Note: /Users/tungsten/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.5/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/tungsten/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.5/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
This error went away after flutter pub upgrade in my case.
same issue
This error went away after
flutter pub upgradein my case.
@ruslanvs Thanks a lot 'pub upgrade' worked for me too.