I have a prop with building my flutter app - android

When I run my app an error message below is shown:
Launching lib\main.dart on AOSP on IA Emulator in debug mode…
lib\main.dart
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings remapped class cache for bq3hllkgb26p0nrblf5gh8d37 (C:\Users\amabd.gradle\caches\5.6.2\scripts-remapped\settings_dok3hc1t57922ptib73pz9y10\bq3hllkgb26p0nrblf5gh8d37\settings8410a2d21ed2f87c8a0398566330ee52).
Could not open settings generic class cache for settings file ‘D:\projects\flutter\photo\photos\android\settings.gradle’ (C:\Users\amabd.gradle\caches\5.6.2\scripts\bq3hllkgb26p0nrblf5gh8d37\settings\settings8410a2d21ed2f87c8a0398566330ee52).
BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript’ Unsupported class file major version 57
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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Could anyone help me to solve this problem?

Go to this folder and delete all cached files.
C:\Users\amabd.gradle\caches
Then try to restart the project.

I got the answer..
you should delete flutter SDK and reinstall it .then make the last update to it by:
flutter upgrade

I have the same problem after hours of searching and removing android studio. I downgraded java to java-8 and set java_home in OS and it worked like a charm.

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?

Flutter Error. Execution failed for task ':app:processDebugMainManifest'

Hey I want to start learning flutter and I bought a course but when I try to run the auto-generated app I get the following error:
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: E:\Flutter\untitled\build\app\intermediates\navigation_json\debug\navigation.json (The system cannot find the file 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
BUILD FAILED in 1m 31s
Running Gradle task 'assembleDebug'...
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: E:\Flutter\untitled\build\app\intermediates\navigation_json\debug\navigation.json (The system cannot find the file 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
BUILD FAILED in 3s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1
I saw other people talk about this here but the solution that worked for them didn't work for me.
Here are the things I've tried:
./gralew clean or./gradlew build
/flutter clean
reinstalling flutter and android studio from scratch.
deleting the gradle files and the build files.
switching to another laptop.
I will be very grateful if you guys can help me.
Best Regards,
-Roee Hovav.
Peace!
Open Android Studio make sure you have the latest version installed, and everything is updated then go ahead and open the Flutter project and trying building it from Android Studio
I found the similar error but for me is missing of androidmanifest.xml and I have fixed it
For me I have deleted the android folder and run command "flutter create ."
then I got another of errors about "SdkMinVersion" and "Flutter multidex handling is disabled." and fixed it step by step
Anyway I have found this solution after I have fixed and hope it will help you
--> changing gradle version as the link below
https://github.com/tekartik/sqflite/issues/380

i have problem with my flutter app when i run the code gradle task takes too long i tried flutter doctor ,it says that all things is right ,then error

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\tyous\StudioProjects\untitled\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.android.internal.version-check'.
Could not create plugin of type 'VersionCheckPlugin'.
> Could not generate a decorated class for type VersionCheckPlugin.
> Lcom/android/ide/common/repository/GradleVersion;
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 3m 51s
Exception: Gradle task assembleDebug failed with exit code 1
if you run the first time it will download the grandle documentation. after that it wont take a long time
Just wait for some time, if you code is right , it will run on your Virtual Emulator soon. Android Studio does take time to load and personally lags on my PC if I am doing something simultaneously.
I recommend you to connect your personal device in Android Studio. It might give you quicker results.
Coming back to your error, does this help?
Android Studio - Failed to apply plugin [id 'com.android.application']

Could not initialize class org.codehaus.groovy.reflection.ReflectionCache #Ubuntu #flutter #androidStudio

I'm unable to run my first flutter project, running flutter run throws
Could not initialize class
org.codehaus.groovy.reflection.ReflectionCache
[ FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
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 5s Exception: Gradle task assembleDebug failed with
exit code 1 ]
I use Ubuntu operating system and Android Studio as my IDE. please help
thanks in advance
Firstly your JDK version should be between 8 and 14 .
I solve this problem by going in the file
my_projet/android/gradle.properties
and put the command org.gradle.java.home=/path/to/jdk your version of the jdk should be between 8 and 14 , if jour jdk version is 14 it will not pass.
Because i am on Ubuntu OS i have written
eg: org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64
and after i run my project all works fine

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