flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[cloud_firestore] Flutter App working in development but not production, CloudFirestorePlugin.java uses or overrides a deprecated API, uses unchecked or unsafe operations

Open ghost opened this issue 6 years ago • 10 comments

@ericel commented on May 18, 2019, 7:06 AM UTC:

My app works well when I do development debug. However, when I do flutter build and flutter install the apk to device, clicking on app, just says stopped working!

dependencies


environment:
  sdk: ">=2.2.0 <3.0.0"

dependencies:

 flutter:
    sdk: flutter
  firebase_auth: ^0.11.1
  google_sign_in: ^4.0.1+3
  flutter_facebook_login: ^2.0.0
  firebase_core: ^0.4.0+1
  cloud_firestore: ^0.11.0+2
  cloud_functions: ^0.3.0+1
  scoped_model: ^1.0.1
  rxdart: ^0.22.0
  intl: ^0.15.8
  moment: ^0.0.1
  http: ^0.12.0+2
  flutter_launcher_icons: "^0.7.0"
  braintree: ^0.1.2
  dio: ^2.1.3

Error or warning I get during the build:

Note: C:\dev\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.11.0+2\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\dev\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.11.0+2\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\dev\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.0+1\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Beside that, no other real error logs.

What can be the solution to this?

This issue was moved by jmagman from flutter/flutter#32957.

ghost avatar Jan 22 '20 23:01 ghost

@munjata commented on May 18, 2019, 5:38 PM UTC:

I experienced a similar issue last night when I uploaded a released version. The debug version was working fine, but not the release one. When I attached the physical device, and run in release mode from Android Studio, I noticed that it fails when trying to write a downloading file from firestore.

Faulty code

Directory tempDir = Directory.systemTemp; final File file = File("${tempDir.path}/$fileName");

final StorageReference strRef =
    FirebaseStorage.instance.ref().child("$COLLECTIONS/$fileName");

print("++++++++++++++ STARTING DOWNLOAD++++++++++++++++");
final StorageFileDownloadTask downloadTask =
    strRef.writeToFile(file);

// ==========================================================================

Add path_provider: ^0.4.1

import 'package:path_provider/path_provider.dart';

Directory tempDir = await getTemporaryDirectory();
final File file = File("${tempDir.path}/$fileName");

final StorageReference strRef =
    FirebaseStorage.instance.ref().child("$COLLECTIONS/$fileName");

print("++++++++++++++ STARTING DOWNLOAD++++++++++++++++");
final StorageFileDownloadTask downloadTask =
    strRef.writeToFile(file);

ghost avatar Jan 22 '20 23:01 ghost

@artashsanoyan commented on May 19, 2019, 10:01 AM UTC:

So this is the flutter sdk and plugins compatibility issue. If you are using the latest version of firebase plugins also make sure that you are using the last version of flutter sdk which is 1.6.0 at this moment.

ghost avatar Jan 22 '20 23:01 ghost

@harshapulikollu commented on May 19, 2019, 2:21 PM UTC:

I also had this same issue, suddenly my app started crashing in release build. From the logcat in android studio I came to know firebase_auth plugin causing the crash on startup of app and I updated it and it resolved the issue and nothing crashes further on.

ghost avatar Jan 22 '20 23:01 ghost

Hi @ericel are you still experiencing the same issue with the latest stable version of flutter and the latest flutterfire plugin? thank you

iapicca avatar Jan 24 '20 14:01 iapicca

Hi @ericel are you still experiencing the same issue with the latest stable version of flutter and the latest flutterfire plugin? thank you

I am still facing it

rahuldevgarg avatar Jan 26 '20 16:01 rahuldevgarg

I am having same issue and my app crashes sometimes because of it.

Note: C:\Users\Umair\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_remote_config-0.3.0+3\android\src\main\java\io\flutter\plugins\firebase\firebaseremoteconfig\MethodCallHandlerImpl.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. D/FlutterView(17284): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@859147d Note: C:\Users\Umair\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\cloud_firestore-0.13.4+1\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

Omi231 avatar Mar 12 '20 06:03 Omi231

Please could someone provide the error stacktrace for the crash from adb logs, thanks

Salakar avatar Apr 20 '20 13:04 Salakar

I have the same issue only in my build release. Please help.

CloudFirestorePlugin.java uses unchecked or unsafe operations. and doesn't work.

erwinvasquez avatar May 11 '20 22:05 erwinvasquez

I have the same issue only in my build release. Please help.

CloudFirestorePlugin.java uses unchecked or unsafe operations. and doesn't work.

Same here!

teekamsuthar avatar May 17 '20 07:05 teekamsuthar

Hey all, as part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you

Salakar avatar Jul 09 '20 15:07 Salakar