ProcessException: Process "C:\Users\Ayushi Sharma\attempt\android\gradlew.bat" exited abnormally: - flutter

Error running Gradle:
ProcessException: Process "C:\Users\Ayushi Sharma\attempt\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Ayushi Sharma\attempt\android\app\build.gradle' line: 24
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin [id 'com.android.application']
Minimum supported Gradle version is 5.4.1. Current version is 5.1.1. If using the gradle wrapper, try editing the
distributionUrl in C:\Users\Ayushi Sharma\attempt\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip
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 0s
Command: C:\Users\Ayushi Sharma\attempt\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Need help!!!!!!

To resolve, change com.android.tools.build:gradle:3.2.1 => com.android.tools.build:gradle:3.3.2, run flutter clean and try the build again.
According to the Gradle_release_note, the current (July 2019) version of the plugin and gradle are 3.4.2 and 5.1.1 respectively. I don't know if Flutter officially supports this version, although it seems to work on my project here and a clean build is markedly faster. The release notes cover some of the changes from 3.2.x => 3.3.x => 3.4.x.
To upgrade to the current version, edit android\gradle\wrapper\gradle-wrapper.properties to source Gradle 5.1.1, and then you're able to upgrade the Gradle plugin to 3.4.2.
Note that once gradle 5.1.1 is being used, you can still set the plugin version back to 3.2.1 to reproduce the issue.

Related

Flutter app run issue - FAILURE: Build failed with an exception

FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':platform_device_id' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
* 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 26s
Exception: Gradle task assembleDebug failed with exit code 1
In .yaml file platform_device_id: ^1.0.1
',I need to fix app run issues.
It's an error due to the latest version of Gradle used in the project.platform_device_id Package contains a lower Gradle and Kotlin version that is not supported to build with the latest Gradle version.
There's also a GitHub issue ongoing, you can check it out with this link
The solution is to use this plugin called device_info_plus instead. It is presented by the Flutter community itself so it works seamlessly as you expected. Also, it works will all platforms.

I've been taking an error in flutter and couldn't fix it

Even I remove and setup again nothing changed.
error
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\Ozgur\Documents\flutterprojects\android\settings.gradle' (C:\Users\Ozgur\.gradle\caches\7.4\scripts\ea4ydi90mwjg9g63m7r6nimmx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
I remove program and setup again added JAVA_HOME path and reinstall Java JDK-19 and didn't fix
it looks like gradle cache issues, remove the cache and re-install it via android studio, i will auto-install it based on the version you specified.
I recently fixed error it's happening due to gradle version and JDK version aren't capatible. There are 2 solution one of them is remove JDK 19 completelty and install JDK 17 instead of it. Or edit link in gradle-wrapper.properties like this gradle-7.4-all.zip

Build works on local but fails on codemagic | Execution failed for task ':app:stripDebugDebugSymbols'

I'm trying to implement a continuous deployment system to build my app and deploy to Google Play using codemagic. Doing a build works fine locally but fails remotely on codemagic.
Error summary:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> 1 exception was raised by workers:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''
Complete log:
== Building for Android ==
> flutter build appbundle --debug
Running "flutter pub get" in My_Project... 1,655ms
💪 Building with sound null safety 💪
Running Gradle task 'bundleDebug'...
[flutter_background_geolocation] Purging debug resources in release build
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/builder/programs/flutter_2_5_3/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.1/android/src/main/java/com/baseflow/geocoding/GeocodingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> 1 exception was raised by workers:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''
* 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 2m 19s
Running Gradle task 'bundleDebug'... 141.1s
Gradle task bundleDebug failed with exit code 1
Build failed :|
Failed to build for Android
Current configuration on codemagic:
Flutter channel: stable
Mode: debug
Build for: Android
to fix this you need to upgrade Gradle version in android/gradle/wrapper/gradle-wrapper.properties to 6.7.1 or commit gradle wrapper to your repository if you don't have this file.
Additional to that you also might need to upgrade Android Gradle plugin in andriod/build.gradle
- classpath 'com.android.tools.build:gradle:3.5.4'
+ classpath 'com.android.tools.build:gradle:4.2.0'
WITHOUT GRADLE UPGRADE
if for some reasons you can't upgrade Gradle version you can freeze previous NDK version.
For that you can specify ndkVersion "22.1.7171670" in your build.gradle and make sure you use Java 1.8 since there is an issue with using latest Java versions.
In Codemagic you can specify Java version in environment section in your codemagic.yaml like this
workflows:
workflow-name:
environment:
ndk: r22b
java: 1.8

There is a error in android studio but same code working on flutlab.io

i tried to run a basic code in android studio. but it showing error. but the same code successfully compiled on flutlab.io
here is the error message.
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\HP\AndroidStudioProjects\helloapp\android\settings.gradle' (C:\Users\HP\.gradle\caches\6.7\scripts\1fnwrr8g4rohfp291nvlxj5qe).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
i'm new to android studio. so please tell what's the wrong here.
Try to use JAVA SDK 15.
First remove your old JDK, and download & install Java JDK 15 from here.
Then, in Android Studio, change the path to the Java JDK so that it matches the latest install. Finally, restart Android Studio to apply the changes.

Exception: Gradle task assembleDebug failed with exit code 1 (runs at web but doesn't at emulator)

I'm having this issue when I try to run the standard flutter new project app:
Launching lib\main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\AndroidStudioProjects\good_heart\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.5. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in E:\AndroidStudioProjects\good_heart\android\gradle\wrapper\gradle-wrapper.properties to gradle-6.5-all.zip
* 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
This happens when I try to run it in a android emulator (one provided by android studio), doesn't happen when I run it in Edge(web) though, it runs smoothly.
Any thoughts? Already tried installing older versions of JDK (such as 11 and 8). Reinstalling Android Studio and flutter... Running it from VScode outputs the same error.
If you Use Android Studio Emulator
Open AVD Manager then select your Emulator right click it and select or click on Wipe data or Cold Boot Now and then run or launch your app your project
hope its help to you
you need to update your Gradle wrapper
go to android/gradle/wrapper/gradle-wrapper.properties and change the last line to: distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip Android Studio will download the necessary library.