flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

Warnings from the cloud_firestore plugin on Android: FirebaseCorePlugin.java uses unchecked or unsafe operations

Open kroikie opened this issue 7 years ago • 38 comments

Steps to Reproduce

  1. Create a new project
  2. Add dependency for cloud_firestore: ^0.8.0
  3. 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

kroikie avatar Oct 13 '19 18:10 kroikie

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 (!)

Viktoru avatar Oct 14 '19 21:10 Viktoru

Me too :(

anhdt-eas avatar Jan 15 '20 08:01 anhdt-eas

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.

nedwdev avatar Jan 25 '20 19:01 nedwdev

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.

rahuldevgarg avatar Jan 26 '20 15:01 rahuldevgarg

Same here

FlorianBouron avatar Feb 01 '20 18:02 FlorianBouron

Problem persists on cloud_firestore: ^0.13.4

Dx avatar Mar 02 '20 03:03 Dx

Me too, is there any update for this issue?

awancilik avatar Mar 07 '20 05:03 awancilik

set: multiDexEnabled true solved for me.

project/android/app/build.gradle:

defaultConfig {
      ......
       multiDexEnabled true
   }

mrafif87 avatar Mar 09 '20 04:03 mrafif87

Problem persists on cloud_firestore-0.13.4+2

alvaroybanez avatar Mar 28 '20 11:03 alvaroybanez

Persists on cloud_firestore: 0.13.5

flutter: ^1.12.13

multiDexEnabled true does not solve the problem for me.

relativityboy avatar Apr 16 '20 17:04 relativityboy

Persists on cloud_firestore: ^0.13.5. Also, why is this Closed when it's not been solved yet???

victorvaz2 avatar Apr 26 '20 00:04 victorvaz2

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.

praveen-gm avatar Apr 27 '20 12:04 praveen-gm

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.

wiaam-kareem avatar Apr 28 '20 21:04 wiaam-kareem

same here, this annoying bug seems already here ages. tried anything I can find to solve it, but Nooooooooo....

Peng-Qian avatar May 03 '20 17:05 Peng-Qian

Same problem with cloud_firestore: ^0.13.5

imarindam avatar May 07 '20 04:05 imarindam

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).

erwinvasquez avatar May 07 '20 20:05 erwinvasquez

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.

fiicode avatar May 08 '20 17:05 fiicode

This error went away after flutter pub upgrade in my case.

ruslanvs avatar May 10 '20 23:05 ruslanvs

same issue

niypoo avatar May 11 '20 13:05 niypoo

This error went away after flutter pub upgrade in my case.

@ruslanvs Thanks a lot 'pub upgrade' worked for me too.

mazen96 avatar May 11 '20 15:05 mazen96