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

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

Related

Issue on building flutter apk with flutter_tts dependency

I was building a flutter app in a Windows machine and I stopped working on it for several months, after that I now get issues on running the app. It shows those two errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Build file 'C:\Users\okeyr\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-3.6.3\android\build.gradle' line: 31
What went wrong:
A problem occurred evaluating project ':flutter_tts'.
org/gradle/api/services/BuildService
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.
==============================================================================
2: Task failed with an exception.
Where:
Script 'C:\Program Files\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 463
What went wrong:
A problem occurred configuring project ':flutter_tts'.
Failed to notify project evaluation listener.
Cannot invoke method substring() on null object
compileSdkVersion is not specified.
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
Flutter doctor shows everything fine except:
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
But I don't think the issue is related with that.
I've I look in depth at failure number 1. I have check the file that gives the error and I found that in line 31:
apply plugin: 'kotlin-android'
So I just went to the file and deleted all the entries related with kotlin, because I am not using Kotlin (I guess).
Then if I rerun the app it now shows another error (related with tts again), but doesn't show the previous ones (not sure if I've moved forward or backwards)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\okeyr\AndroidStudioProjects\fluttertestapp\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:24: error: cannot find symbol
flutterEngine.getPlugins().add(new com.tundralabs.fluttertts.FlutterTtsPlugin());
^
symbol: class FlutterTtsPlugin
location: package com.tundralabs.fluttertts
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
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 16s
Exception: Gradle task assembleDebug failed with exit code 1
After doing a search I found many people with that similar issue (even though none was related to tts plugin) which had adressed it with a flutter pub cache repair or a flutter clean. However, a flutter clean gives me no changes and error persists and when I have executed flutter pub cache repair it had shown:
Failed to repair flutter_tts 3.6.3. Error:
Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Reinstalled 29 packages.
Failed to reinstall 1 package:
flutter_tts 3.6.3
pub finished with exit code 69
Now, if I rerun the code it gives me new error:
The plugin flutter_tts doesn't have a main class defined in C:\Users\okeyr\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-3.6.3\android\src\main\java\com\tundralabs\fluttertts\FlutterTtsPlugin.java or C:\Users\okeyr\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_tts-3.6.3\android\src\main\kotlin\com\tundralabs\fluttertts\FlutterTtsPlugin.kt. This is likely to due to an incorrect androidPackage: com.tundralabs.fluttertts or mainClass entry in the plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage entry or move the main class to any of locations used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the meanwhile.
This error also appears when running pub get or pug upgrade. But if I run pub outdated it gives me that:
Showing outdated packages.
[*] indicates versions that are not the latest available.
Package Name Current Upgradable Resolvable Latest
direct dependencies: all up-to-date.
transitive dependencies:
characters *1.2.1 *1.2.1 *1.2.1 1.3.0
collection *1.17.0 *1.17.0 *1.17.0 1.17.1
js *0.6.5 *0.6.5 *0.6.5 0.6.7
meta *1.8.0 *1.8.0 *1.8.0 1.9.0
path *1.8.2 *1.8.2 *1.8.2 1.8.3
transitive dev_dependencies:
matcher *0.12.13 *0.12.13 *0.12.13 0.12.14
test_api *0.4.16 *0.4.16 *0.4.16 0.4.18
all dependencies are up-to-date.
Process finished with exit code 0
I can't see any dependency related with tts.
Now here I am stucked in that error, I don't know how to proceed. If there is someone who could help me see the light I'd be grateful. Thanks in advance.
I am trying to run the code but it seems tts package is not well defined, anyone that could bring me some help?

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 build error: Execution failed for task ':firebase_core:compileDebugJavaWithJavac'

I am using flutter version 2.2.2 and the latest android studio for the moment.
I have a Flutter project that worked fine few months ago, but now - after upgrading flutter and dart - it does not run.
I tried downgrading flutter and dart, but kept getting the same error when running:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0
* 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 18s
Exception: Gradle task assembleDebug failed with exit code 1
I have this pubspec.yaml dependencies:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
email_validator: '^1.0.5'
path_provider: ^1.6.18
social_share: ^2.0.5
firebase_admob: ^0.10.2
I tried changing firebase_admob to google_mobile_ads but that did not solve the problem either.
I am already using AndroidX.
Can any body see a problem? Does anybody have a possible solution?
Thanks!
The problem was with the JAVA DEVELOPMENT KIT version.
I changed it to version 11.0.11 and it worked just fine.
To do that, download the right JDK and change the JAVA_HOME environment variable.
IMPORTANT: a Java version too new might not work as well. Version 11 should be fine (and 8 as others over the internet stated).

Error when trying to run command 'flutter run'

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.

Unable to find java.lang package for flutter

I'm beginner for flutter. After coding something I want to simulate codes for Android emulator. I could run successfully a few days ago but today I can't. Error code says unable to find package java.lang. I didn't find where I should look for find problem. SDK path is correct, flutter doctor didn't find any problem. Also I can run project with iOS emulator. I am working on MacOS. Here whole error information.
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':location:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 7s
Gradle task assembleDebug failed with exit code 1
You may want to run with verbose enabled, flutter run -v. Then you can find the possible error and warnings. It also happens when your code is incompatible to the gradle version. And the solution for it is to delete .gradle from your use home folder, then on next build flutter will redownload compatible gradle version. In case of Linux, rm -rf ~/.gradle.
Main problem is about packages. Some of them needs android migrate to androidx. When project migrated androidx, problem is solved.
Documentation

Categories

Resources