Unable to create bundle in flutter - android

I am building a flutter project using Gradle. When I ran
flutter build appbundle
I got the error as shown below
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':image_gallery_saver:compileReleaseKotlin'.
> Kotlin could not find the required JDK tools in the Java installation '/Library/Internet
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' used by Gradle. Make
sure Gradle is running on a JDK, not JRE.
* 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 24s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done
25.7s Gradle task bundleRelease failed with exit code 1
Please help me regarding this issue.
Thanks in advance!

Make sure Gradle is running on a JDK, not JRE
You are running gradle on a JRE instead of a JDK, install JDK 16 or below (17 is not supported yet), append its bin directory to the PATH variable and remove the one of the JRE.

Related

fastutil 7.2.0 .jar cannot be created

I have installed android studio properly, gave it all it needed for flutter development, java jdk version is 11, paths are properly given, the emulator runs fine but when i try to build my app on either emulator or a physical device, I get this error:
Launching lib\main.dart on V2109 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'D:\untitled1\android\app\build.gradle' line: 26
What went wrong:
A problem occurred evaluating project ':app'.
java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\ADMIN.gradle\caches\jars-9\53ad1f30a5eec66e4e9dc584d5b89b7f\fastutil-7.2.0.jar.
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
Here is my flutter doctor response
Please help. Your help will be appreciated
I was expecting the project to run properly, as with the same flutter doctor response and same installation procedures on 2 different laptops I was able to run properly. I have tried reinstalling android studio thrice but of no help. tried everything I could related to java (installed different versions, updating paths).

Build Failed in react native

I was working with react native in my windows 10 for months. after upgrading to windows 11 and installing previous tools , I am not able to run my react native project . I installed android studio , SDK, JDK, node and other tools like before. but I got this error after running npx react-native run-android command:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Username\Documents\React Native Projects\myapp\android\app\build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
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 38s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\Username\Documents\React Native Projects\myapp\node_modules\react-native-gradle-plugin\src\main\java\com\facebook\react\codegen\generator\SchemaJsonParser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Username\Documents\React Native Projects\myapp\android\app\build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
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 38s
at makeError (C:\Users\Username\Documents\React Native Projects\myapp\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\Username\Documents\React Native Projects\myapp\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\Username\Documents\React Native Projects\myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\Username\Documents\React Native Projects\myapp\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
This question was asked many times before, but I did not get an answer from them . I tried gradlew clean but I get same error (Build Failed). for some developers chmod +x gradlew worked. but it is for Linux and Mac. I am using windows . is there any replacement command for windows or other way to fix this problem ?
thanks .
Open Android Studio Settings and follow this path. Open the dropdown for Gradle JDK and select 11 from the dropdown.

why does my flutter app not work after repeated reinstallations of java and gradle?

I have a problem with my Flutter app.
When I tried to start my app via an emulator, I got the following error message:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\AdoptOpenJDK\jre-11.0.11.9-hotspot' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
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
.
this is the standrad app which is created by flutter when creating a project and I have not changed it. When I received the message for the first time, I reinstalled gradle and java. but it didn't work. Can you help me?

Ionic Aangular :No installed build tools found. Install the Android build tools version 19.1.0 or higher

I'm trying to build an Ionic Android app but no matter what i do i get this error, here is the full error
===========================================================================
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Program Files\Java\jdk1.8.0_251 (recommended setting)
ANDROID_HOME=C:\Program Files\Java\jdk1.8.0_251 (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Configure project :appProject evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Peter Snee\Documents\AngularIonic\quotesApp\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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
C:\Users\Peter Snee\Documents\AngularIonic\quotesApp\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Peter Snee\Documents\AngularIonic\quotesApp\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
===========================================================================
I have uninstalled Android studio, i have changed a few environment variables, nothing seems to be working for me so im probably missing something,
Any help is greatly appreciated !
thanks
Got it,
It turns out my paths were wrong in the environment variables,
I ran
android list sdk
in the cmd and got the exact paths,
rookie mistake but sure look.

Why do i get this error when trying to build cordova app in Android studio

I have installed the latest build-tools; 29.0.2. Still it says no build-tools installed
C:\Users\user\Downloads\android-studio-ide-\android-studio\bin\runnerw.exe C:\Users\user\AppData\Roaming\npm\cordova.cmd run android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\user\AppData\Local\Android\Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\user\LagBus\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
Configure project :app
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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
C:\Users\user\LagBus\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\user\LagBus\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':app'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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
Picked up _JAVA_OPTIONS: -Xmx1024M
It might be that you don't have the android tools configured in your PATH, so cordova can't find them.
So, check that, in your path you have access to the android build tools and even other Android development environment configurations.
This is an example of a problem similar to yours, and how to solve it:
According to this: https://github.com/ionic-team/ionic/issues/13120
EDIT: you have your answer here

Categories

Resources