app does not work when Run in Flutter in Android Studio is pressed

1.5k Views Asked by At
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/platform-2.2.1/lib/src/interface/local_platform.dart:45:41: Error: Member not found: 'packageRoot'.
  String get packageRoot => io.Platform.packageRoot;
                                        ^^^^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 28s
Exception: Gradle task assembleDebug failed with exit code 1

I received this error when I tried to run my flutter app on an emulator in android-studio. How do I solve this issue?

2

There are 2 best solutions below

0
Vishesh Pandey On

Platform.packageRoot member variable now has been removed in the platform plugin. All you need to do is override dependency to the previous version.

dependency_overrides:
  platform: 2.2.0
0
Maisam Hindawi On

It worked but by using

dependencies:

platform: ^3.1.0