Whenever I apply the firebase_messaging plugin, The compiler throws deprecated error on building for android. I tried to change the gradle version, it works in debug mode but not in release. Kindly help regarding this, Its very crucial for me. Thank you.
error: method findAppBundlePath in class FlutterMain cannot be applied to given types;
String appBundlePath = FlutterMain.findAppBundlePath();
^
required: Context
found: no arguments
reason: actual and formal argument lists differ in length
1 error
Finished with error: Gradle task assembleDebug failed with exit code 1
same error?
what is your flutter version? Upgrading to Flutter (Channel stable, v1.9.1+hotfix.2) fixed the same. FlutterMain.findAppBundlePath(Context applicationContext); is marked as deprecated in the update.
But what if I don't want to change the Flutter version at all? We are on the verge of completing a project. I am using the version ^1.7.8+hotfix.4.
Until yesterday evening everything worked fine.
The same issue
@DagobertDokate by any means did you run flutter pub upgrade? that might have downloaded the latest plugin (5.1.6). For now you can manually update FlutterMain.findAppBundlePath() to send context.getApplicationContext() / context in the FlutterFirebaseMessagingService.java file and see if it helps. (Is not recommended but worth trying)
@satyen893 Not that I'm aware of. Flutter --version also says version 1.7. The only thing I did was flutter pub cache repair.
@DagobertDokate you can change you dependency to firebase_messaging: ">=5.0.2 <5.1.5"
Works with v1.7
I don't see the problem directly:
I have the following pubspec:
There I refer to 5.1.5
name: push_messaging_client
description: A new Flutter package.
version: 1.1.0
author:
homepage:
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.4.0+9
firebase_messaging: ^5.1.5
http: ^0.12.0+2
shared_preferences: ^0.5.3+4
cockpit_base:
git:
url: git@git..../appgalaxy/cockpit-base.git
ref: develop
flutter_notification_channel:
git:
url: git@git.../appgalaxy/flutter-notification-channel.git
ref: master
dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^4.1.0
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
But the dependency tree says 5.1.6. Why? oO
Dart SDK 2.4.0
Flutter SDK 1.7.8+hotfix.4
push_messaging_client 1.1.0
|-- cockpit_base 1.0.1
| |-- flutter...
| |-- http...
| |-- intl 0.15.8
| | '-- path...
| |-- rxdart 0.22.2
| '-- tracking_client 0.0.1
| |-- firebase_analytics 4.0.2
| | |-- flutter...
| | '-- meta...
| |-- firebase_core...
| |-- firebase_crashlytics 0.1.0+3
| | |-- flutter...
| | '-- stack_trace...
| |-- firebase_performance 0.3.0+5
| | '-- flutter...
| |-- flutter...
| |-- http...
| '-- sentry 2.2.0
| |-- http...
| |-- meta...
| |-- stack_trace...
| '-- usage 3.4.1
| '-- path...
|-- firebase_core 0.4.0+9
| |-- flutter...
| '-- meta...
|-- firebase_messaging 5.1.6
| |-- flutter...
| |-- meta...
| '-- platform 2.2.1
|-- flutter 0.0.0
| |-- collection 1.14.11
| |-- meta 1.1.6
| |-- sky_engine 0.0.99
| |-- typed_data 1.1.6
| '-- vector_math 2.0.8
|-- flutter_notification_channel 0.0.1
| '-- flutter...
|-- flutter_test 0.0.0
| |-- async...
| |-- boolean_selector 1.0.4
| | |-- source_span...
| | '-- string_scanner...
| |-- charcode 1.1.2
| |-- collection...
| |-- flutter...
| |-- matcher 0.12.5
| | '-- stack_trace...
| |-- meta...
| |-- path...
| |-- pedantic...
| |-- quiver 2.0.3
| | |-- matcher...
| | '-- meta...
| |-- source_span 1.5.5
| | |-- charcode...
| | |-- path...
| | '-- term_glyph...
| |-- stack_trace 1.9.3
| | '-- path...
| |-- stream_channel 2.0.0
| | '-- async...
| |-- string_scanner 1.0.4
| | |-- charcode...
| | |-- meta...
| | '-- source_span...
| |-- term_glyph 1.1.0
| |-- test_api 0.2.5
| | |-- async...
| | |-- boolean_selector...
| | |-- collection...
| | |-- matcher...
| | |-- meta...
| | |-- path...
| | |-- pedantic...
| | |-- source_span...
| | |-- stack_trace...
| | |-- stream_channel...
| | |-- string_scanner...
| | '-- term_glyph...
| |-- typed_data...
| '-- vector_math...
|-- http 0.12.0+2
| |-- async 2.2.0
| | '-- collection...
| |-- http_parser 3.1.3
| | |-- charcode...
| | |-- collection...
| | |-- source_span...
| | |-- string_scanner...
| | '-- typed_data...
| |-- path 1.6.2
| '-- pedantic 1.7.0
|-- mockito 4.1.1
| |-- collection...
| |-- matcher...
| |-- meta...
| '-- test_api...
'-- shared_preferences 0.5.3+4
|-- flutter...
'-- meta...
@DagobertDokate comment out firebase_messaging: ^5.1.5 run flutter pub get, then add firebase_messaging: 5.1.4 and run flutter pub get. This should get you the correct version
@DagobertDokate comment out firebase_messaging: ^5.1.5 run flutter pub get, then add firebase_messaging: 5.1.4 and run flutter pub get. This should get you the correct version
Does not solve the problem.
Deleting the .pub-cache directory also does not improve the situation. I am open for further suggestions.^^
How can I check if pub sends me the right packet? What is the link about the pub that loads packages?
did you remove the caret sign before the version number ?
Now I'm really confused. The instructions for Flutter always say very clearly: 'firebase_messaging: ^5.1.6'.
But if I omit '^', it uses the right version.
Should I now remove this from all dependencies? Is this a Flutter/Pub error or do I just not understand the instructions?
I have the latest flutter version-
Flutter 1.9.1+hotfix.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2d2a1ffec9 (13 days ago) • 2019-09-06 18:39:49 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
Only happens when compiling on release mode for android. It works in debug though.
Current configuration -
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:3.2.1'
Build failed LOG------------------------------------>
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':location:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/sumitsmac/Desktop/LIVE/build/location/intermediates/res/merged/release/values/values.xml:276: error: resource android:attr/fontVariationSettings not found.
/Users/sumitsmac/Desktop/LIVE/build/location/intermediates/res/merged/release/values/values.xml:277: error: resource android:attr/ttcIndex not found.
error: failed linking references.
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 1m 54s
Finished with error: Gradle task assembleRelease failed with exit code 1
Kindly Help
Now I'm really confused. The instructions for Flutter always say very clearly: 'firebase_messaging: ^5.1.6'.
But if I omit '^', it uses the right version.
Should I now remove this from all dependencies? Is this a Flutter/Pub error or do I just not understand the instructions?
No you don't need to remove it from all your dependencies. It is just in this case that you need 5.1.5 twhich is compatible with flutter v1.7.
5.1.6 needs flutter v1.9
Yes, but the install guid cleary said 'firebase_messageing: ^5.15'. In every dep is '^'. What i should remove it in this case? I don't understand oO
error: method findAppBundlePath in class FlutterMain cannot be applied to given types;
String appBundlePath = FlutterMain.findAppBundlePath();
^
required: Context
found: no arguments
reason: actual and formal argument lists differ in length
1 error
Finished with error: Gradle task assembleDebug failed with exit code 1same error?
no, Not the same
I have upgraded to firebase_messaging : ^5.1.6 and the error has changed -
Note: /Users/sumitsmac/Documents/Important_flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+3/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: /Users/sumitsmac/Documents/Important_flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.9+3/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':location:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/sumitsmac/Desktop/LIVE/build/location/intermediates/res/merged/release/values/values.xml:276: error: resource android:attr/fontVariationSettings not found.
/Users/sumitsmac/Desktop/LIVE/build/location/intermediates/res/merged/release/values/values.xml:277: error: resource android:attr/ttcIndex not found.
error: failed linking references.
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 2m 3s
Finished with error: Gradle task assembleRelease failed with exit code 1
@DagobertDokate for now to make your application up and running remove '^' from the firebase_messaging dependency, for more information on this please read What is the caret sign (^) before the dependency version number in Flutter's pubspec.yaml?
firebase/cloudfirestore/
this issue is with cloudfirestore plugin
bad 5.1.6 version....
I get this error in ios now o pushing notification -
nw_connection_receive_internal_block_invoke [C4] Receive reply failed with error "Operation canceled"
Kindly help !
same here. Did anyone resolved this issue??
forcing the package version "firebase_messaging: 5.1.5" (remove ^) has solved the issue for me.
i think package v5.1.6 is only compatible with the new flutter v1.9.
Hi @Peteritor
I see there's an open issue addressing the case you described.
Please follow up on that issue,
I'm closing the current one as duplicate.
If you disagree please write in the comments
and I will reopen it.
Thank you
@DagobertDokate by any means did you run
flutter pub upgrade? that might have downloaded the latest plugin (5.1.6). For now you can manually updateFlutterMain.findAppBundlePath()to sendcontext.getApplicationContext() / contextin theFlutterFirebaseMessagingService.javafile and see if it helps. (Is not recommended but worth trying)
we have to add context.getApplicationContext().toStringto work properly
Old version supports
"FlutterMain.findAppBundlePath()"
New upgraded versions supports
"FlutterMain.findAppBundlePath(context)"
This will solve this issue due to upgrade but you might get other issues due to upgrade.
Most helpful comment
forcing the package version "firebase_messaging: 5.1.5" (remove ^) has solved the issue for me.
i think package v5.1.6 is only compatible with the new flutter v1.9.