Error when update facebook_audience_network to 0.9.0 - flutter

Whan update my facebook_audience_network to 0.9.0 then I got this error message
[com.facebook.android:audience-network-sdk:6.4.0] C:\Users\007\.gradle\caches\transforms-2\files-2.1\25a494723d7018266df203e7ea11ccc5\audience-network-sdk-6.4.0\AndroidManifest.xml:12:9-55 Error:
Missing 'package' key attribute on element package at [com.facebook.android:audience-network-sdk:6.4.0] AndroidManifest.xml:12:9-55
[com.facebook.android:audience-network-sdk:6.4.0] C:\Users\007\.gradle\caches\transforms-2\files-2.1\25a494723d7018266df203e7ea11ccc5\audience-network-sdk-6.4.0\AndroidManifest.xml Error:
Validation failed, exiting

AndroidManifest of audience-network-sdk-6.4.0 includes 'queries' element, it requires fixed Gradle plugin.
I've solved the problem by rising Gradle plugin version to 3.6.4.
Here there are more info -
https://android-developers.googleblog.com/2020/07/preparing-your-build-for-package-visibility-in-android-11.html

Probably it's just a package mismatch, try to delete pubspec.lock and run
flutter clean
flutter pub get

Related

flutter The method 'File.create' has fewer named arguments than those of overridden method 'File.create'

When I try to run my Flutter project, I get errors like:
../../../.pub-cache/hosted/pub.dev/file-6.1.2/lib/src/interface/file.dart:15:16: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create'. Future create({bool recursive = false});
Running flutter clean and flutter upgrade didn't help. What's wrong? How do I fix this?
I kept getting the same error, But I solved it adding by adding
file: ^6.1.4 in my dependencies
If you are having the same problem. Make sure you have the latest file dependency.
I think the problem is caused by an outdated reference to file dependency. See this issue.
For fix this, on the project or library folder run:
dart pub upgrade
This command will upgrade your dependencies and the problem will be solved without adding the reference to latest version of file dependency.
I just ran in to this issue and I was on flutter's master channel. I switched back to stable (flutter channel stable) and everything works fine.
For me the packages in my pubspec.yaml were all up to date, but the following fixed it:
Delete pubspec.lock.
Run flutter pub get again.
i solved it by adding file: ^6.1.4 to my pubspec i dont know why this is needed in dependenccies but when i added it worked
this error occured to me when i was trying to update my flutter and packages
but error thrown was of transitive dependencies i guess when u defin in dependencies it over rides the transitive one
but it worked for me
but after wards once project ran i removed the file dependencie from my punspec did a flutter clean and a pub get again and ran the project again it worked without any problem

Can't build after upgrading to Flutter 2.5.1

Once i upgraded to Flutter 2.5.1 my project stops build and run, giving this error:
/Users/admin/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.0.0/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:29: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
/Users/admin/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator_android-2.0.0/android/src/main/java/com/baseflow/geolocator/location/LocationMapper.java:30: error: cannot find symbol
position.put("is_mocked", location.isMock());
^
symbol: method isMock()
location: variable location of type Location
2 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':geolocator_android:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Any idea?
You must have upgraded Geolocator to version 7.7.0, which means you will also need to update your android/app/build.gradle file and set the compileSdkVersion to 31 (it's mentioned in the CHANGELOG).
If you don't want to upgrade the Android compileSdkVersion you should downgrade the geolocator to version 7.6.2 in your pubspec.yaml.
The error is because the compileSdkVersion needs to be changed to 31 for Geolocator 7.7.0 and higher.
You could either do that in android/app/build.gradle file. But I wouldn't recommend it as it will cause more errors with other packages.
Instead, you could downgrade the Geolocator to 7.6.2 in the pubspec.yaml
Or use these commands to downgrade:
dart pub downgrade geolocator
Maybe your version is not upgraded with your packages
The following command will help you for that:
flutter pub get
I just Upgraded my project and got this issue:
Maybe this will work for you:
Run These commands in your terminal:
dart pub downgrade geolocator_android
dart pub downgrade geolocator
Another way is to set Compile and Target Android version to 31.
But I will not recommend it for now coz this will lead you to many other issues.

How to fix this nullOk error when using the flutter_svg package?

I connected the package, added it to main.dart, I try to compile the application, but I get this error. Help! What should I do about it?
error
Launching lib\main.dart on XT1562 in debug mode...
Running Gradle task 'assembleDebug'...
/D:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
/D:/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 15s
Exception: Gradle task assembleDebug failed with exit code 1
Follow the steps below
add the following dependency
flutter_svg: ^0.20.0-nullsafety.3
run flutter clean command
run flutter pub get command
run flutter run command or run the project
Everyone is right: putting flutter_svg: ^0.20.0-nullsafety.3 or flutter_svg: ^0.19.3 (in case you can't migrate to null safety yet) is the solution.
I want to add a little thing: if you're using a package which depends on flutter_svg and you still get the error due to older versions usage, you can fix it in this way:
dependency_overrides:
flutter_svg: ^0.19.3
I lost plenty of time because the flags: ^3.2.2 package was using flutter_svg: ^0.19.1 and it led to the same error.
The problem is that the version of Flutter with null-safety enabled (currently on the beta channel as of writing), the nullOk parameter was removed Localizations.localeOf, but you're using a package (in this case, flutter_svg) that is still using nullOk.
If you're using the null-safe version of Flutter, you should use null-safe versions of other packages too, if available. Alternatively you can stick with the latest version of Flutter without null-safety (version 1.22.x) until all of your dependent packages have been migrated for null-safety.
I have faced the same problem . After I finally got the solution.
Here Simple:
At first you add Pre-Release the following dependency:
flutter_svg: ^0.20.0-nullsafety.3
Then run flutter pub get command
Now you can run your project . See that there is no error .
On line 57 of the locally cached file /lib/src/picture_provider.dart (see the full path from the error message)replace
Localizations.localeOf(context, nullOk: true), with Localizations.maybeLocaleOf(context)
This is quick and dirty solution, but should hold until the package is fixed.
Note that if you want to fix this error for yourself or for a package that you are using, you can fix it the following way
In order to modify your code to use the new form of the APIs, convert all instances of calls that include nullOk = true as a parameter to use the maybe form of the API instead.
MediaQueryData? data = MediaQuery.of(context, nullOk: true);
becomes
MediaQueryData? data = MediaQuery.maybeOf(context);
More about how to migrate towards null-safety in the official documentation
Tried everything, in vain.
Finally, the updating a dependency worked for me.
This is what I updated in my pubspec.yaml file:
Removed
flutter_svg: ^0.18.0
and added
flutter_svg: ^0.20.0-nullsafety.3
Then, ran
flutter pub get
simply go into the file in .pub-cache and correct the argument from localeOf(context, nullOk: true) to localeOf(context)

DualTransitionBuilder is imported from both 'package:flutter/src/widgets/dual_transition_builder.dart' and

After upgrading to version of Flutter 1.20.x I'm getting the following error when building for both iOS and Android.
../../.pub-cache/hosted/pub.dartlang.org/animations-1.1.0/lib/src/shared_axis_transition.dart:241:12: Error: 'DualTransitionBuilder' is imported from both 'package:flutter/src/widgets/dual_transition_builder.dart' and 'package:animations/src/dual_transition_builder.dart'.
return DualTransitionBuilder(
^^^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
I have done a Flutter clean several times, deleted and regenerated the iOS Podfile and manually deleted the flutter_build directory. Every time it regenerates the build with this error.
It's known issue, fixed now. Increase the version to at least 1.1.1 in pubspec.yaml
dependencies:
...
animations: ^1.1.1
and run
flutter pub get

Razorpay flutter 1.1.4 Gradle build exception

In latest version of razorpay_flutter 1.1.4 I have encountered a gradle exception could not open cp_proj remapped class cache for eii7mfeilb85f6s74q7cms80e.
The issue is in this unknown statement.
SOLUTION:
Go to flutter\.pub-cache\hosted\pub.dartlang.org\razorpay_flutter-1.1.4\android.
In build.gradle remove package android line and save.
Now this will work perfectly.