ionic 3: FAILURE: Build failed with an exception - ionic-framework

I am trying to create Android App Bundle for an ionic 3 project. When running the command ./gradlew bundle I get the error below. In the .bash_profile file I have added the following:
export ANDROID_HOME=/Users/dome/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools
The Gradle version is: 4.4.1.
ERROR
iMac:android dome$ ./gradlew bundle
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The onesignal-gradle-plugin MUST be before com.android.application!
Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!
An exception occurred while trying to find the Android build tools.
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 '/Users/dome/myAPP/platforms/android/CordovaLib/cordova.gradle' line: 121
* What went wrong:
A problem occurred evaluating project ':app'.
> Unable to determine Android SDK directory.
* 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
iMac:android dome$

After adding the exports below, I didn't close and reopen the terminal hence the issues. Now sorted.
export ANDROID_HOME=/Users/dome/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools

Related

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 Failed with Minecraft Forge Gradle with VSCode

I am currently setting up my environment to create a Minecraft Mod using VSCode as this is my main editor at work, but I'm getting an error running the .\gradlew genVSCodeRun.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':runtimeClasspathCopy'.
> Could not find net.minecraftforge:forge:1.16.5-36.2.34_mapped_official_1.16.5.
Searched in the following locations:
- file:/C:/Users/luism/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.34_mapped_official_1.16.5/forge-1.16.5-36.2.34_mapped_official_1.16.5.pom
- file:/C:/Users/luism/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.2.34_mapped_official_1.16.5/forge-1.16.5-36.2.34_mapped_official_1.16.5.jar
Required by:
project :
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 18s
I can see that the Gradle importing process is failing because I don't have those two files.
I saw in this thread that the solution is to run the gradle eclipse command, but the Build still fails with the same error. I have the 1.17 JDK as it is recommended in the Forge documentation and pathed it in the VS settings.json. I also downloaded the Forge MDK for 1.16.5 and executing commands in the correct unzipped location of the MDK.
Any ideas about what I'm doing wrong? Thanks!

Gradle error while running flutter app in Android Studio

Anytime I try to run the default flutter app in android studio, I get an error saying this
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\NAME\StudioProjects\first_app\android\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not open proj generic class cache for build file 'C:\Users\Jonat\StudioProjects\first_app\android\app\build.gradle' (C:\Users\Jonat\.gradle\caches\6.7\scripts\9jolsr12r2iru3ssdih8as3s3).
> 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
I tried searching for an answer but I did not find a solution. I decided to open my command prompt and type in Gradle and this is what I see,
I don't know what to do or where to start since I am new to android studio. Is there a way to get rid of this error?
UPDATE
I went to the folder that was mentioned in the first error and all I needed to do was update the Gradle and it loaded everything. But now I'm receiving a new error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #77e838c
* 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.
would anyone know how to go about this error?

Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'

App was working completely fine but suddenly it is invoking the following issue.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':google_sign_in:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':google_sign_in:debugCompileClasspath'.
> Could not resolve project :google_sign_in_web.
Required by:
project :google_sign_in
> Unable to find a matching configuration of project :google_sign_in_web:
- None of the consumable configurations have attributes.
* 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
Finished with error: Gradle task assembleDebug failed with exit code 1
I have imported the latest google_sign_in package in pubspec.yaml but still facing the same build failed error. Any help please!
Solved it by running following command in flutter terminal:
flutter pub cache repair
All of the packages were downloaded and re-installed again.

Flutter build error: A problem occurred configuring root project 'bidirectional_scroll_view'

I am trying to build my project to APK file, but I am stuck with this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'bidirectional_scroll_view'.
> Failed to notify project evaluation listener.
> org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V
* 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 910ms
The plugin bidirectional_scroll_view could not be built due to the issue above.
The command I had run is this: flutter build apk --split-per-abi.
If someone would help me I would be glad! :D
I was just using an old version of bidirectional_scroll_view package.