Error when trying to run command 'flutter run' - android

I was trying to run command 'flutter run' Its giving me errors. There are no issues with flutter doctor. I don't know where the error is from, I tried to run this flutter clean, flutter pub cache repair, flutter run. Still the same error.
Warning: You are using these overridden dependencies:
! intl 0.17.0
Running "flutter pub get" in cretello_rentors_plus_1... 34.3s
Using hardware rendering with device sdk gphone x86 arm. If you notice graphics
artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
/C:/src/flutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/dynamic_theme-1.0.1/lib/dynamic_theme.dart:25:46: Error: Method not found: 'TypeMatcher'.
return context.ancestorStateOfType(const TypeMatcher<DynamicThemeState>());
^^^^^^^^^^^
/C:/src/flutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/dynamic_theme-1.0.1/lib/dynamic_theme.dart:25:20: Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutterSDK/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorStateOfType'.
return context.ancestorStateOfType(const TypeMatcher<DynamicThemeState>());
^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutterSDK\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 43s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 44.8s
Exception: Gradle task assembleDebug failed with exit code 1```

try one of this solutions
———
https://github.com/fluttercommunity/flutter_google_places/issues/140

This issues is due to your flutter versions. If you are copying others code, make sure to first run.
flutter clean
flutter pub get
If this does not work make sure you use the correct versions of the flutter sdk.

Related

Execution failed for task ':app:compileFlutterBuildDebug' get package

I have been stuck on this error for a while now. So I have this flutter project and I was refactoring a bit of my code and I used a specific package for this (the package in question: https://pub.dev/packages/get). But then I got this error and since then I still haven't been able to run my app. My guess for this error is that still somewhere this packaged is maybe cached but I'm not sure. I removed the package from my pubspec.yaml and is not used in any file anymore. I have tried flutter clean and flutter pub get
this is the output of my flutter docotor
flutter doctor output
this is how my pubspec.yaml looks like
dependencies:
flutter:
sdk: flutter
provider: ^6.0.3
flutter_svg: ^0.18.0
vibration: ^1.7.5
highlight_text: ^0.7.2
avatar_glow: ^1.2.0
camera: ^0.10.0+3
image_gallery_saver: ^1.7.1
geolocator: ^7.7.1
geocoding: ^2.0.1
torch_light: ^0.4.0
I also have tried removing the pubspec.lock file and the build file
this is the stacktrace of the error
`
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
FAILURE: Build failed with an exception.
Where:
Script 'D:\School\Academiejaar 3\Semester 1\Mobile Applications\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'D:\School\Academiejaar 3\Semester 1\Mobile Applications\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 1m 39s
Running Gradle task 'assembleDebug'... 109.2s
Exception: Gradle task assembleDebug failed with exit code 1
`
This is a group project so I have tried clean cloning because the weird thing is that my groupmates can run this project without a problem. I also have reinstalled my flutter and I am now using flutter 3.3.8
For my android emulator I am using Android studio where I have a Google Pixel 2 with api version 30. I also have tried running it on a real phone but this produces the same error, I also have not been successful in getting a different error.
So to conclude: I tried a package which got me this error and I have removed this package from my pubscpec.yaml and is not used in any file so I am stuck with this error.
All help is appreciated

unable to run flutter run after upgarding to flutter 2.8.0 from 2.5.3

This is the error
Running "flutter pub get" in inventory_controller...
6.2s Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering
with "--enable-software-rendering". Launching lib/main.dart on Android
SDK built for x86 in debug mode...
../../../Downloads/Programs/flutter/.pub-cache/hosted/pub.dartlang.org/visibility_detector-0.2.0/lib/src/visibility_detector_layer.dart:276:21:
Error: Too many positional arguments: 1 allowed, but 2 found. Try
removing the extra positional arguments.
super.addToScene(builder, layerOffset);
^
FAILURE: Build failed with an exception.
Where: Script '/home/bihire/Downloads/Programs/flutter/packages/flutter_tools/gradle/flutter.gradle'
line: 1070
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/home/bihire/Downloads/Programs/flutter/bin/flutter'' 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 40s Running Gradle task 'assembleDebug'...
41.9s Exception: Gradle task assembleDebug failed with exit code 1
I did flutter clean ans flutter pub cache repair both without any success.
Is there anything else I should try?
Try to find out package that depends on this package and upgrade it version.
To find out package use in terminal: flutter pub deps
PS: i had to upgrade alice version in my case.
fixed it by updating visibility_detector to latest.
visibility_detector: ^0.2.2

flutter run for android failed - flutter.gradle' line: 991 - finished with non-zero exit value 1

After flutter upgrade flutter to newest stable version I can't debug in android simulator. I get the following error:
Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_webservice-0.0.19/lib/src/utils.dart:61:27: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
'Uri' is from 'dart:core'.
return httpClient.get(url, headers: headers);
^
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_webservice-0.0.19/lib/src/utils.dart:74:28: Error: The argument type 'String' can't be assigned to the parameter type 'Uri'.
'Uri' is from 'dart:core'.
return httpClient.post(url, body: body, headers: postHeaders);
^
3
FAILURE: Build failed with an exception.
Where:
Script '/Users/michael/Documents/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/michael/Documents/Developer/flutter/bin/flutter'' 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 33s
Exception: Gradle task assembleDebug failed with exit code 1
Author of google_maps_webservice plugin (https://pub.dev/packages/google_maps_webservice) does not release flutter 2.0.2 compatible version yet.
You can switch to 0.0.20-nullsafety.2 version (https://pub.dev/packages/google_maps_webservice/versions/0.0.20-nullsafety.2)
add explicitly
google_maps_webservice: ^0.0.20-nullsafety.2
to dependencies in pubspec.yaml
Update the compileSdkVersion to 30 in my app/build.gradle
do not forget run:
flutter clean
flutter pub get
i had the same issue, but after i move the folders to android studio projects folder it worked fine

Flutter packages path not found

I've installed Flutter without Android Studio following these two tutorials: https://medium.com/#quicky316/install-flutter-sdk-on-windows-without-android-studio-102fdf567ce4 and https://dev.to/ejgamer21/install-flutter-without-android-studio-58bi.
I have connected my phone with USB debugging enabled and I've run flutter doctor: everything seems to be fine (although I haven't configured an IDE yet). Then I've tried to run the "Hello world" example that comes with Flutter using flutter run in the hello_world directory, but I get this error:
lib/main.dart:5:8: Error: Error when reading '/C:/b/s/w/ir/k/archive/flutter/packages/flutter/lib/widgets.dart': Impossibile trovare il percorso specificato.
import 'package:flutter/widgets.dart';
^
lib/main.dart:12:16: Error: Method not found: 'Key'.
key: Key('title'),
^^^
lib/main.dart:13:26: Error: Getter not found: 'TextDirection'.
textDirection: TextDirection.ltr
^^^^^^^^^^^^^
lib/main.dart:11:9: Error: Method not found: 'Text'.
Text('Hello, world!',
^^^^
lib/main.dart:9:11: Error: Method not found: 'Center'.
const Center(
^^^^^^
lib/main.dart:8:3: Error: Method not found: 'runApp'.
runApp(
^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\mpepi\Android\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\mpepi\Android\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 4s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4,7s
Exception: Gradle task assembleDebug failed with exit code 1
("Impossibile trovare il percorso specificato" means "Couldn't find the specified path")
Something seems to be wrong with the path for the packages, I have located the required file at C:\Users\mpepi\Android\flutter\packages\flutter\lib which of course is different from the one in the first line. I have set all environment variables as the tutorials explain, what am I missing?
Delete in the .vscode file. Restart the flutter application of visual studio code and run 'Flutter run'. It worked for me.
You could try to set "File Transfer" mode on your phone, it usually is on the notification bar if the phone is conected
For some cases I've also faced the similar issue. This problem is likely to arise when flutter doesn't get the packages. It wasn't even getting the material package, like your widget package.
Fix: Go to pubspec.yaml file. Make sure your internet connection is on and working. If you're developing in vscode you'll find buttons at top-right corner. Click Get Packages and wait until flutter downloads the packages.
If you don't find those buttons, then from the command line navigate to the project folder and run flutter pub get or flutter packages get.

Flutter build failed in ubuntu 19.10

I have a flutter apps which is building perfectly in another machine(ubuntu 18.04). Now I am using ubuntu 19.10 , when I tried to run this apps using flutter run command, its throws these errors:
Launching lib/main.dart on Primo EF6 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Cannot create service of type PayloadSerializer using ToolingBuildSessionScopeServices.createPayloadSerializer() as there is a problem with parameter #2 of type PayloadClassLoaderFactory.
> Cannot create service of type PayloadClassLoaderFactory using ToolingBuildSessionScopeServices.createClassLoaderFactory() as there is a problem with parameter #1 of type CachedClasspathTransformer.
* 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 4s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 5.5s
Gradle task assembleDebug failed with exit code 1
I think it is gradle issue. I am using flutter v1.12.13+hotfix.6
Fixed this problem. There was a permission issue on .gradle directory, it was readonly . So changing permission solves this issue.

Categories

Resources