Deprecation error in audio_service plugin flutter - flutter

I tried to run an application but it is giving the following deprecation error. I have upgraded to flutter 3 since then I am getting this error. I have tried flutter clean, pub get, pub repair.
Still, the error is constant.
I am using audio_service: ^0.18.2 and just_audio: ^0.9.24 versions.

That error means you are compiling against the next beta release of Android which deprecates some methods that were being used by audio_service. Someone has already submitted an issue on the project's GitHub page to support this beta version of Android, and the latest audio_service release should now support it.

Related

Error in Flutter while using Provider tool

I am building a basic app using flutter, in which I had to use provider, I added Provider dependencies in pubspec.yaml file but getting this error please help, I added the error below not able to fix this problem I have the latest flutter SDK
To solve this use lower version of Provider dependency as newer version of provider depends on newer version of Flutter SDK and your application's Flutter SDK is old one so it will have compatibility issues, So just degrade the version of dependency or you can also run pub outdated command and it will suggest you compatible version as per your SDK.

The plugin admob_flutter uses a deprecated version of the Android embedding

when i put admob_flutter: ^2.0.0-nullsafety.1 in pubspec, and type on cmd flutter pub get this error occurs!
The plugin admob_flutter uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of
Flutter will remove these deprecated APIs.
It's for latest flutter updates. so you can't do anything. Please use other package or wait till fix the problem by package developer because this error is produced after flutter version 2.5.
I have downgraded my flutter version by command flutter downgrade and it shows an option of a downgraded flutter version and it resolves my error.
Downgrading flutter worked for me.

The method 'setMockMessageHandler' isn't defined for the class 'BasicMessageChannel<dynamic>'

After running the Flutter project, I get this error. What can I do to solve it?
Error: The method 'setMockMessageHandler'
isn't defined for the class 'BasicMessageChannel<dynamic>'.
FAILURE: Build failed with an exception.
I had the same problem after update plugin's in AndroidStudio on Mac
flutter pub upgrade
did nothing for me, but
flutter clean
flutter pub upgrade --major-versions
has solved the problem
Go to specified class 'BasicMessageChannel' by press and hold ctrl and click on it
than search for the 'setMockMessageHandler' by ctrl+F
than u will see something like this
// Looking for setMockMessageHandler?
// See this shim package: packages/flutter_test/lib/src/deprecated.dart
and paste this line below this comment
void setMockMessageHandler(dynamic message){
}
but this is just simple hack which is not recommended
I had the same problem today.
from what i could notice, this basically was a breaking change caused by transition of platform channel test interfaces to flutter_test package.
in my case, the problem was resolved just running the flutter pub upgrade on a global terminal session.
see more details about the mentioned transition on referred release notes
I have the same problem, I have tried all the above and did not help.
flutter pub upgrade and flutter pub upgrade --major-versions outputs this:
No dependencies changed.
1 package is discontinued.
76 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.
No changes to pubspec.yaml!
The plugins advance_pdf_viewer, flutter_absolute_path, geocoder, google_api_headers, onesignal_flutter use a deprecated version of the
Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise,
consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding:
https://flutter.dev/go/android-plugin-migration.
Running across this problem after upgrading to Flutter 2.5.3 (from 2.2.3). The change outlined in the release notes broke several hundred tests since the mock method handlers were set in the global setUp() for most tests.
As shown in the release notes, I replaced code like
MethodChannel('channelName')
.setMockMethodCallHandler((MethodCall methodCall) {});
with code using the default instance of TestDefaultBinaryMessenger:
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
.setMockMethodCallHandler(MethodChannel('channelName'), (MethodCall methodCall) {});
This change allowed me to keep all tests unchanged.

ERROR with flutter: CocoaPods not installed even if it is installed

I am trying to run my code on AndroidStudio by using Flutter but when I run it shows an error:
Warning: CocoaPods not installed. Skipping pod install. CocoaPods is
used to retrieve the iOS and macOS platform side's plugin code that
responds to your plugin usage on the Dart side. Without CocoaPods,
plugins will not work on iOS or macOS. For more info, see
https://flutter.dev/platform-plugins To install see
https://guides.cocoapods.org/using/getting-started.html#installation
for instructions.
CocoaPods not installed or not in valid state. Error launching
application on iPhone 11.
flutter doctor shows that all is fine, I looked around a lot and tried lots of things like uninstall it and install it again, and tried adding:
dev_dependencies:
build_runner: ^1.10.0
dependency_overrides:
analyzer: 0.39.14
and tried
flutter channel stable
flutter upgrade
and tried
flutter channel master
flutter upgrade
But nothing worked, note that when I write "which pod" it shows the path, that means it exists right? then what is the problem? please help :(
have you tried to run pod install from the ios folder?
The only thing that worked with me is using android emulator, ios simulator still show the same error
I had the same issue and I found a solution, but with still an answered question. See my question (and one partial solution) here
The partial solution is: in Android Studio, click on the tab "Terminal" at the bottom of the IDE and in this pane, type flutter run. It does the same as the button Run, and Android Studio stopped complaining about CocaPods.
To stop the app, type q in the same terminal.

Flutter app Error while initializing the Dart VM: Wrong full snapshot version, expected '8343.....' found '46b2....'

flutter app was working getting build and run on Xcode 10 on device iOS 12 fine before,
The time dart upgrade 2.1.0 happen in Flutter build iOS worked well with command and on Xcode 10 after build get success while running Flutter app on iPhone 7 iOS 12, it started giving error and app gets crash with following error message in Xcode logs.
Error is Runner[410:28754] [VERBOSE-3:dart_vm.cc(403)] Error while initializing the Dart VM: Wrong full snapshot version, expected '8343f188ada07642f47c56e518f1307c' found '46b2bfb57b5647c5f7527ff9aa56c69b'
Here are the details of the flutter sdk and dart .
Flutter 0.11.9 • channel beta • https://github.com/flutter/flutter.git
Framework • revision d48e6e4
Engine • revision 5c8147450d
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
I have experienced this error and none of the above solution worked for me infact the option of clearing the flutter/bin/cache messed the entire vscode IDE.
So I deleted the entire flutter SDK and installed fresh new SDK from flutter official website.
After this installation everything was working fine.
I had this issue after a flutter upgrade. Uninstalling the app from the device and then flutter running it again solved the problem.
After deleting the flutter/bin/cache and running flutter clean, I couldn't get the dart sdk to load until I launched the flutter console (flutter_console.bat) that can be found in the directory where you installed flutter and ran flutter doctor there. That solved the problem.
Do git clean -xffd in flutter installed directory(repo).
If it's a Flutter project first try flutter clean if did not work, try above git command.
If still not solved, delete everything inside /flutter/bin/cache and try.
If still not :D,
Do flutter channel master, flutter upgrade, and flutter clean. If nothing worked please add a comment below.
If you are in Dart environment out flutter/bin/cach/dart-sdk, you may be not upgraded dart-sdk. This happen to me Dart 2.5.0 with chololate installed. So I just did choco upgrade dart-sdk
I have exactly this problem i Solve it how ?
by these comments you just update flutter
flutter channel beta
,
flutter upgrade
you should upgrade your dart sdk
So try this command :
choco install dart-sdk
if this is not work for you download it from this link
https://dart.dev/tools/sdk/archive;
and replace it with your current dart-sdk in flutter
I also have experienced the same issue. I upgraded the flutter version and later downgraded and encounter this issue maily on IOS adhoc build.
Solution:
Delete out $FLUTTER_HOME/bin/cache and run flutter doctor.
This will solve.
What worked for me was changing channel and upgrading and then changing channel back and upgrading.
I had to remove the flutter SDK folder in my computer completely and redownload the latest one at https://flutter.dev/docs/get-started/install/macos
Then, I ran flutter doctor.
You can find where your flutter folder is by typing which flutter in your terminal.
You don't need to uninstall the whole flutter and set environment path or anything else.
Just downgrade to any version by doing the below commands, suppose my current flutter version is v3.3.8 and I come across this issue then:
Go to flutter sdk-path in the command prompt and checkout to any branch you would like to switch for a moment, like v2.5.0. So,
By doing this you changed your repository from v3.3.8 to v2.5.0
git checkout v2.5.0
You can check previous flutter versions from here
link
Downgrade your flutter version to 2.5.0
flutter downgrade v2.5.0
Then upgrade flutter
flutter upgrade