Recently I've updated to flutter 2.5 and the newest androids studio, and tried to compile my flutter project to android device. Android studio throws me the error below. If I write flutter run
in a terminal there is no problem compiling to android device.
Guess this must be related to android studio. I tried downgrade to an earlier android studio version, but the problem persists.
I'm not sure what plugin this is, it doesn't seem like any I use in my project.
Edit: If I downgrade flutter from 2.5 to 2.0 my project compiles again. So the problem is within flutter 2.5
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
../plugins/flutter/.pub-cache/hosted/pub.dartlang.org/photo_view-0.11.1/lib/src/core/photo_view_gesture_detector.dart:106:29: Error: The argument type 'PointerEvent' can't be assigned to the parameter type 'PointerDownEvent'.
- 'PointerEvent' is from 'package:flutter/src/gestures/events.dart' ('../plugins/flutter/packages/flutter/lib/src/gestures/events.dart').
- 'PointerDownEvent' is from 'package:flutter/src/gestures/events.dart' ('../plugins/flutter/packages/flutter/lib/src/gestures/events.dart').
super.addAllowedPointer(event);
There was an API change in version 2.5 of flutter and several packages must update accordingly. Your logs show that the exact package which contains the error is photo_view.
Luckily enough the package has just been updated to fix this, so just update its version in your pubspec.yaml
:
photo_view: ^0.12.0
You have two options
1 It's probably a transient dependency, you can run flutter pub deps
to list the installed packages and its dependencies and try to update the one that uses photo_view
(if it does have an update)
2 Add a dependency override to your pubspec.yaml
, this will effectively override the version of the package being used
dependency_overrides:
photo_view: ^0.12.0
Add this just before your dev_dependencies