Flutter dependencies are deprecated in iOS - firebase

I know many Flutter developers use lots of different packages in their applications. Nowadays, I'm trying to build a final version of my app in iOS but it gives me headache. I'm using packages such as image_picker, flutter_local_notifications, flutter_inappwebview, firebase_messaging etc. Due to compatibility issue on Firebase libraries, I need to target min. iOS 10.0.
These are the versions of some libraries that give errors when building to iOS on Simulator.
image_picker: ^0.6.7+22
flutter_local_notifications: ^4.0.1
flutter_inappwebview: ^4.0.0+4
# Only Firebase_messaging gives errors between Firebase libraries but
# I would like to show you the versions of all of them
firebase_admob: ^0.11.0+1
firebase_messaging:
firebase_core: ^0.7.0
firebase_auth: ^0.20.0+1
cloud_firestore: ^0.16.0
A little part of warnings related to firebase_messaging
In module 'UIKit' imported from /Users/zahidtekbas/Documents/GitHub/projectxyz-Flutter-App/projectxyz/ios/Pods/Target Support
Files/firebase_messaging/firebase_messaging-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Li
brary/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
explicitly marked deprecated here
typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
^
/Users/zahidtekbas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin
.m:294:70: warning: 'UIUserNotificationTypeBadge' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications
Framework's UNAuthorizationOptions [-Wdeprecated-declarations]
#"badge" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeBadge],
^
In module 'UIKit' imported from /Users/zahidtekbas/Documents/GitHub/projectxyz-Flutter-App/projectxyz/ios/Pods/Target Support
Files/firebase_messaging/firebase_messaging-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Li
brary/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:17:32: note: 'UIUserNotificationType' has been
explicitly marked deprecated here
typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
^
/Users/zahidtekbas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin
.m:295:70: warning: 'UIUserNotificationTypeAlert' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications
Framework's UNAuthorizationOptions [-Wdeprecated-declarations]
#"alert" : [NSNumber numberWithBool:notificationSettings.types & UIUserNotificationTypeAlert],
And there are these kind of deprecated methods, deprecated UI elements errors in warning output. When I target min. iOS 9.0, this time GoogleMobilAds, FirebaseInstanceID, flutter_inappwebview-4.0.0+4 etc. give errors.
So I can't avoid errors and warnings when building for iOS no matter what platform I'm targeting. Any idea how to solve the long paragraphs of error messages due to deprecated stuff?
Edit: I'm adding output of flutter doctor -v
[✓] Flutter (Channel beta, 1.26.0-17.8.pre, on macOS 11.2 20D64 darwin-x64, locale en-TR)
• Flutter version 1.26.0-17.8.pre at /Users/zahidtekbas/flutter
• Framework revision 044f2cf560 (3 days ago), 2021-02-24 13:02:05 -0800
• Engine revision 042c82b02c
• Dart version 2.12.0 (build 2.12.0-259.16.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/zahidtekbas/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 53.0.5
• Dart plugin version 203.6912
[✓] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.4.1
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 943E0837-6EB7-45F6-B9F0-EC00160B2CDE • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.192
End of the build output:
4 warnings generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team
ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')

I got same issue, even i minimumOSVersion was set to 11.0 , and IPHONEOS_DEPLOYMENT_TARGET set to 11.0 , error deprecated still show, maybe ploblem with Xcode , btw i use Xcode 12.4 and 12.2 still error

Upgrading to new Flutter version solved my problem. If anyone see this, consider upgrading your dependencies and Flutter.

Related

Flutter web exception caught by widget library (but only in debug). "Cannot read properties of undefined..."

We have a strange error that occurs intermittently in our Flutter Web app. When I say intermittent, I mean when you run the app through "flutter run -d chrome" 50% of the time it will work, and 50% of the time the app will halt with this error:
"The following JSNoSuchMethodError was thrown building _ScaffoldMessengerScope:
TypeError: Cannot read properties of undefined (reading 'AnimationController')"
I bolded the "AnimationController" here because it is not always the same object. The object that errors out varies from run to run. And it's usually not the same object.
The other strange thing is that if I build the project and then deploy the build/web folder to a web server, and load the app from there, the error does not occur. This is a problem that happens strictly when executing "flutter run -d chrome". It happens on every engineer's machine too. Some of us run Macs and some are on Windows. Everyone has the same issue, although not everyone has it at the same frequency. Some see it happen once or twice an hour, and others see it almost every run.
Doing a "flutter clean" does not solve the problem.
We thought the issue could be related to our use of firebase through the Flutterfire package because we saw there were some related issues posted by other users on Stackoverflow. But so far updating the package, re-installing the package, and commenting out the firebase script inclusions in the index.html do not seem to solve the issue.
Flutter doctor output seems nominal as well:
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale en-US)
• Flutter version 2.8.1 at /Users/hreddy/Code/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (5 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/hreddy/Library/Android/sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.63.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.32.0
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.99
• No issues found!
The full output when the error occurs is as follows (you can see in this run it again occurred for a different random object):
TypeError: Cannot read properties of undefined (reading 'FirebaseFirestoreWeb')
at Object.registerPlugins (http://localhost:4999/packages/wiijii_visuals/generated_plugin_registrant.dart.lib.js:27:25)
at main (http://localhost:4999/web_entrypoint.dart.lib.js:31:35)
at main.next (<anonymous>)
at runBody (http://localhost:4999/dart_sdk.js:40211:34)
at Object._async [as async] (http://localhost:4999/dart_sdk.js:40242:7)
at main$ (http://localhost:4999/web_entrypoint.dart.lib.js:30:18)
at http://localhost:4999/main_module.bootstrap.js:19:10
at Array.forEach (<anonymous>)
at window.$dartRunMain (http://localhost:4999/main_module.bootstrap.js:18:32)
at <anonymous>:1:8
at Object.runMain (http://localhost:4999/dwds/src/injected/client.js:8709:21)
at http://localhost:4999/dwds/src/injected/client.js:23792:19
at _wrapJsFunctionForAsync_closure.$protected (http://localhost:4999/dwds/src/injected/client.js:3511:15)
at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:4999/dwds/src/injected/client.js:11510:12)
at Object._asyncStartSync (http://localhost:4999/dwds/src/injected/client.js:3475:20)
at main__closure3.$call$body$main__closure (http://localhost:4999/dwds/src/injected/client.js:23804:16)
at main__closure3.call$1 (http://localhost:4999/dwds/src/injected/client.js:23731:19)
at StaticClosure._rootRunUnary (http://localhost:4999/dwds/src/injected/client.js:3873:18)
at _CustomZone.runUnary$2$2 (http://localhost:4999/dwds/src/injected/client.js:12858:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:4999/dwds/src/injected/client.js:12805:14)
at _ForwardingStreamSubscription._sendData$1 (http://localhost:4999/dwds/src/injected/client.js:12395:19)
at _ForwardingStreamSubscription._add$1 (http://localhost:4999/dwds/src/injected/client.js:12341:15)
at _ForwardingStreamSubscription._add$1 (http://localhost:4999/dwds/src/injected/client.js:12674:12)
at _MapStream._handleData$2 (http://localhost:4999/dwds/src/injected/client.js:12735:12)
at _ForwardingStreamSubscription._handleData$1 (http://localhost:4999/dwds/src/injected/client.js:12700:20)
at BoundClosure.eval (eval at Closure_forwardCallTo (http://localhost:4999/dwds/src/injected/client.js:1439:14), <anonymous>:3:44)
at StaticClosure._rootRunUnary (http://localhost:4999/dwds/src/injected/client.js:3873:18)
at _CustomZone.runUnary$2$2 (http://localhost:4999/dwds/src/injected/client.js:12858:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:4999/dwds/src/injected/client.js:12805:14)
at _ControllerSubscription._sendData$1 (http://localhost:4999/dwds/src/injected/client.js:12395:19)
at _ControllerSubscription._add$1 (http://localhost:4999/dwds/src/injected/client.js:12341:15)
at _SyncStreamController._sendData$1 (http://localhost:4999/dwds/src/injected/client.js:12189:32)
at _SyncStreamController.add$1 (http://localhost:4999/dwds/src/injected/client.js:12070:15)
at BoundClosure.eval (eval at Closure_forwardInterceptedCallTo (http://localhost:4999/dwds/src/injected/client.js:1519:14), <anonymous>:3:45)
at StaticClosure._rootRunUnary (http://localhost:4999/dwds/src/injected/client.js:3873:18)
at _CustomZone.runUnary$2$2 (http://localhost:4999/dwds/src/injected/client.js:12858:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:4999/dwds/src/injected/client.js:12805:14)
at _ControllerSubscription._sendData$1 (http://localhost:4999/dwds/src/injected/client.js:12395:19)
at _ControllerSubscription._add$1 (http://localhost:4999/dwds/src/injected/client.js:12341:15)
at _SyncStreamController._sendData$1 (http://localhost:4999/dwds/src/injected/client.js:12189:32)
at _SyncStreamController.add$1 (http://localhost:4999/dwds/src/injected/client.js:12070:15)
at _GuaranteeSink.add$1 (http://localhost:4999/dwds/src/injected/client.js:23287:25)
at HtmlWebSocketChannel_closure1.call$1 (http://localhost:4999/dwds/src/injected/client.js:23556:149)
at _EventStreamSubscription_closure.call$1 (http://localhost:4999/dwds/src/injected/client.js:17826:26)
at StaticClosure._rootRunUnary (http://localhost:4999/dwds/src/injected/client.js:3879:16)
at _CustomZone.runUnary$2$2 (http://localhost:4999/dwds/src/injected/client.js:12858:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:4999/dwds/src/injected/client.js:12805:14)
at _CustomZone_bindUnaryCallbackGuarded_closure.call$1 (http://localhost:4999/dwds/src/injected/client.js:12995:25)
at invokeClosure (http://localhost:4999/dwds/src/injected/client.js:1262:26)
at WebSocket.<anonymous> (http://localhost:4999/dwds/src/injected/client.js:1281:18)
Any idea what direction we should investigate further?
The solution for me is when I first run the flutter app on my IDE, I hit the refresh button on the browser where the app runs and won't encounter it again until I close my IDE.

convert for DateTime in Flutter does not seem to work correctly

converting with milliseconds differs from the original after conversion.
Microsecond conversion works fine.
Testcode:
print("---Milliseconds:");
DateTime dateTimeStart = DateTime.now();
print("Datetime: $dateTimeStart");
int milliseconds = dateTimeStart.millisecondsSinceEpoch;
print("Milliseconds: $milliseconds");
DateTime dateTimeEnd = DateTime.fromMillisecondsSinceEpoch(milliseconds);
print("DateTimeEnd: $dateTimeEnd");
print("---Microseconds:");
print("Datetime: $dateTimeStart");
int microseconds = dateTimeStart.microsecondsSinceEpoch;
print("Microseconds: $microseconds");
DateTime dateTimeEnd2 = DateTime.fromMicrosecondsSinceEpoch(microseconds);
print("DateTimeEnd2: $dateTimeEnd2");
Output:
I/flutter (26574): ---Milliseconds:
I/flutter (26574): Datetime: 2020-05-13 18:40:12.675351 <----- not equal among each other !!!
I/flutter (26574): Milliseconds: 1589388012675
I/flutter (26574): DateTimeEnd: 2020-05-13 18:40:12.675 <----- not equal among each other !!!
I/flutter (26574): ---Microseconds:
I/flutter (26574): Datetime: 2020-05-13 18:40:12.675351 <----- equal
I/flutter (26574): Microseconds: 1589388012675351
I/flutter (26574): DateTimeEnd2: 2020-05-13 18:40:12.675351 <----- equal
Or do I have a bug somewhere?
flutter doctor -v
[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 10.0.18362.836], locale de-DE)
• Flutter version 1.17.0 at C:\AndroidStudio\FlutterSDK\flutter
• Framework revision e6b34c2b5c (11 days ago), 2020-05-02 11:39:18 -0700
• Engine revision 540786dd51
• Dart version 2.8.1
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\richa\AppData\Local\Android\sdk
• Platform android-29, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.0)
• VS Code at C:\Users\richa\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.1
[√] Connected device (1 available)
• SM J510UN • a29a4ea7 • android-arm • Android 6.0.1 (API 23)
• No issues found!
This is not a bug. When you do millisecond conversion you are losing the greater precision that using microseconds provides. You're dropping all of the additional microseconds that the DateTime contains when you use milliseconds.

Flutter: Java uses or overrides a deprecated API

I've been trying to use the auth, firestore firebase in an Android / IOS flutter application, and have been experiencing many different issues, after testing several different versions. Now it's showing me several messages in the build log.
build log
Note:
D:\Flutter\SDK\flutter.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.3+1\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java
uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. Note: D:\Flutter\SDK\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. D8: Cannot fit requested classes in a single dex file (# methods: 81454 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while
merging dex archives: The number of method references in a .dex file
cannot exceed 64K. Learn how to resolve this issue at
https://developer.android.com/tools/building/multidex.html
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to
complete
at com.android.tools.r8.utils.t.a(:55)
at com.android.tools.r8.D8.run(:11)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
... 34 more Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit
requested classes in a single dex file (# methods: 81454 > 65536)
at com.android.tools.r8.utils.Reporter.a(:21)
at com.android.tools.r8.utils.Reporter.a(:7)
at com.android.tools.r8.dex.VirtualFile.a(:33)
at com.android.tools.r8.dex.VirtualFile$h.a(:5)
at com.android.tools.r8.dex.ApplicationWriter.a(:13)
at com.android.tools.r8.dex.ApplicationWriter.write(:35)
at com.android.tools.r8.D8.d(:44)
at com.android.tools.r8.D8.b(:1)
at com.android.tools.r8.utils.t.a(:23)
... 36 more
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeDexDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 4m 33s
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows
[Version 10.0.18362.535], locale en-IN)
• Flutter version 1.12.13+hotfix.5 at D:\Flutter\SDK\flutter
• Framework revision 27321ebbad (3 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK
version 29.0.2)
• Android SDK at C:\Users\admin\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android SDK\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at D:\Android SDK
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
pubspec
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.15.3
cloud_firestore: ^0.13.0+1
build.gradle(android)
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.0'
}
You need to use the following plugin:
dependencies:
firebase_auth: ^0.15.3
cloud_firestore: ^0.13.0+1
Don't forget to configure firebase:
https://pub.dev/packages/cloud_firestore#setup
https://pub.dev/packages/firebase_auth#usage
Also in your app/build.gradle, increase the minSdkVersion:
Change this:
minSdkVersion 16
into this:
minSdkVersion 23
In order to use minSdkVersion below 21 you will have to configure your app for multidex like this:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
After this please run the
flutter pub upgrade
flutter pub get
flutter clean
flutter run
It will still throw the warning after flutter clean, but at least it will be possible for supporting earlier versions.
More to check out on official docs

Flutter app crashes when it use Firestore plugin in Release mode

Everything works perfectly when in debug mode. It first happened when I update Flutter version to 1.10.x I could not remember which version did I use, properly. It should be 1.7.8, it was stable. To fix it I downgrade the flutter to 1.7.8+4 and also downgrade firebase related pub packages. But error still here.
Stack Trace for Related Error, captured from gogle play console
java.lang.RuntimeException:
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:379)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run (AsyncQueue.java:2)
at android.os.Handler.handleCallback (Handler.java:790)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:7000)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1408)
Caused by: java.lang.AbstractMethodError:
at com.google.protobuf.GeneratedMessageLite.a (GeneratedMessageLite.java:1319)
at com.google.firebase.firestore.proto.WriteBatch.s (WriteBatch.java:120)
at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:162)
at com.google.firebase.firestore.proto.WriteBatch.a (WriteBatch.java:15)
at com.google.firebase.firestore.proto.WriteBatch$Builder.a (WriteBatch.java:835)
at com.google.firebase.firestore.local.LocalSerializer.a (LocalSerializer.java:172)
at com.google.firebase.firestore.local.SQLiteMutationQueue.a (SQLiteMutationQueue.java:188)
at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:237)
at com.google.firebase.firestore.local.LocalStore$$Lambda$2.get (LocalStore.java:8)
at com.google.firebase.firestore.local.SQLitePersistence.a (SQLitePersistence.java:195)
at com.google.firebase.firestore.local.LocalStore.a (LocalStore.java:201)
at com.google.firebase.firestore.core.SyncEngine.a (SyncEngine.java:227)
at com.google.firebase.firestore.core.FirestoreClient.a (FirestoreClient.java:200)
at com.google.firebase.firestore.core.FirestoreClient$$Lambda$11.run (FirestoreClient.java:6)
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:311)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call (AsyncQueue.java:2)
at com.google.firebase.firestore.util.AsyncQueue.a (AsyncQueue.java:287)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run (AsyncQueue.java:4)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:457)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run
(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run (AsyncQueue.java:205)
at java.lang.Thread.run (Thread.java:764)
When I saw the error trace on device (in android crash report dialog) It mentioned Firebase 19.0.0
Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17134.1069], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2017 15.9.7)
[√] Android Studio (version 3.4)
[√] VS Code, 64-bit edition (version 1.38.1)
[√] Connected device (3 available)
• No issues found!
Error reporoducing scenario for final describe:
Build app with flutter run --release
App try an basic firestore call
Firestore.instance.collection('collection-name').document('docuemnt-id').get()
App crashes.
Also getting the same error with building with flutter build appbudle
Here is the solution of my nightmare.
EDIT:
Error
FATAL EXCEPTION: main
Process: com.app.android, PID: 12668
java.lang.RuntimeException: Internal error in Firestore (19.0.0).
at com.google.firebase.firestore.g.j.a(:379)
at com.google.firebase.firestore.g.g.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
To fix this error, update android.enableR8=false in gradle.properties. You need to add this row cause default value true.
I was facing the same problem, and the following changes to my build.gradle solved it.
android {
compileSdkVersion 28
...
buildTypes {
release {
shrinkResources false
minifyEnabled false
signingConfig signingConfigs.release
}
}
}
Reference: https://github.com/FirebaseExtended/flutterfire/issues/1412#issuecomment-570161645
N.B. I know its not a perfect solution to disable minify. But it seems the firebase team is working on it and will be resolved in future update
I was able to keep android.enableR8=true by upgrading the gradle version.
android/build.gradle
from:
classpath 'com.android.tools.build:gradle:3.2.1'
to:
classpath 'com.android.tools.build:gradle:3.5.0'
android/gradle/wrapper/gradle-wrapper.properties
from:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
to:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
I have a similar case (same error), so I'll try to tell you what happened and maybe is the same issue that you have.
In my case I lost the keystore, so I pass through all the process of ask for a new key and so on, after that I publish a new version and my app crash in the exact way of yours, after a lot of google and stuff I figured out that have something to do with the signature (because works in debug but do not work in release), so I get into the firebase console and download again the google-services.json file, and surprise... the file have a block that wasn't there before.
After that, I test in a device with the command that you provide here (by the way thanks!), and woala! It works.
I also update the SHA-1 Signature key in the console, so that may help too.
I hope that my response help you to come out to some solution.
https://github.com/flutter/flutter/issues/41576
changing to version 3.4.2 i.e com.android.tools.build:gradle:3.4.2 in build.gradle(project) , worked for me.

Android Awareness Api not compatible with Xamarin Forms

Visual Studio Version:
14.0.25431.01 Update 3
Xamarin.Android Version:
7.0.2.42
Xamarin Forms Version:
Tried 2.3.3.193, 2.3.4.192-pre2 & 2.3.3.180.
Operating System & Version:
Win 10 Pro ver. 1607 build 14393.693
Google Play Services Version:
Xamarin.GooglePlayServices.Awareness ver. 42.1001.0
Describe your Issue:
Xamarin.GooglePlayServices.Awareness doesn't work with Xamarin Forms.
Error:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2072,3): error MSB6006: "java.exe" exited with code 2
Steps to Reproduce:
Create a blank Xamarin Forms project & use Xamarin.GooglePlayServices.Awareness as described in Xamarin's blog post.
This error often caused by dex methods count limits. You should turn on "MultiDex" support in android project settings. Also you should update ProGuard in Android SDK (see Xamarin.Android release notes - https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.1/)

Resources