Build Failed : En error occurring in 'command prompt' during building ionic2 application - android-studio

BUILD FAILED
Total time: 7.548 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'. >
You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
also updated sdk for the same error , but still facing the same

I have Removed android platform ($ ionic platform remove android ) and re-installed it ($ ionic platform add android ) .
after then problem was no more. got my build successfully.
Thanks for your responses all of you.

Related

ionic cordova [ERROR] An error occurred while running subprocess

I am using the command ionic cordova build and I get the following errors and I don't find a clear answer on this. With this error I can not pass the application to android studio
cordova-plugin-androidx-adapter: Processed 14 source files in 635ms
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\andres\AppData\Local\Android\sdk (recommended setting)
ANDROID_HOME=C:\Users\andres\AppData\Local\Android\Sdk (DEPRECATED)
Using Android SDK: C:\Users\andres\AppData\Local\Android\sdk
FAILURE: Build failed with an exception.
What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17.0.4\bin\java.exe
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
Command failed with exit code 1: C:\Program Files\gradle-7.5\bin\gradle.BAT -p C:\Users\andres\Desktop\aplicacion\platforms\android wrapper -b C:\Users\andres\Desktop\aplicacion\platforms\android\wrapper.gradle
[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.
enter image description here
The issue might be with you java version according to the question description.
C:\Program Files\Java\jdk-17.0.4\bin\java.exe
Java 11 is supported for cordova 10+ which allows for the same minimum Android versions as cordova 9. This should now be the preferred solution.
So you need to check your ionic, cordova and java version and set it accordingly.
I hope this helps.

why i cannot run any flutter project?

I am using android studio to run flutter project, now i can not run any project and i get the same error every time:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\moham\AppData\Local\Android\sdk
* 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 29s
Exception: Gradle task assembleDebug failed with exit code 1
it seem you did not accepted all licences after install.
Try to run this:
flutter doctor --android-licenses
and then press y every time it ask, to accept the licence
seems like duplicate of this
you should delete config Android studio folder and reinstall that whit all requirements.
C:\Users[your name folder]

Build failed- Flutter

I had to reinstall my windows and so I had to freshly install Android studio, flutter sdk and everything.
After completing all my installations I am unable to run my project. Before upgrading the system my project was working all fine with 0 errors.
Flutter doctor:
C:\Users\Admin>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.959], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)
• No issues found!
Error:
Launching lib\main.dart on Mobile in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':agora_rtc_engine:extractDebugAnnotations'.
> Could not resolve all files for configuration ':agora_rtc_engine:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> dl.google.com
> Could not download uast.jar (com.android.tools.external.org-jetbrains:uast:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> dl.google.com
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> Could not GET 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> jcenter.bintray.com
* 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 46s
Exception: Gradle task assembleDebug failed with exit code 1
This is the first time I am moving my project from my original system to this new one.
I don't have enough reputation to comment so I will write it as an answer. Since it is the first time running the app, make sure you have an internet connection so it can download the required files.
Solution:
As of now what I have done is the following:
agora_rtc_engine that was showing up as error I have removed it. (I will be re-adding this package as this is required for my app)
java jdk download i have added I was getting error on keytool to generate SHA1 Key Fingerprint.
I updated my SHA1 Key Fingerprint in Firebase. I have to do this as I was getting error when login in using Google sign-in.
Now my App is working fine with no errors.
This might not be the correct solution for the issue, so feel free to give your suggestion on the above error that I had faced.

react-native installation in ubuntu

smackuser#smackcoders:~/Documents/projects/Awesome$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.562 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Go to Android SDK Manager and under tools install Android SDK Build-tools 23.0.1.
You can access SDK Manager by either typing android in your terminal or going to your android-sdk/tools directory and from there typing ./android

java.security.NoSuchAlgorithmException while building a simple android app using Android Studio

I downloaded the Android Studio and trying to build a simple Login Activity. But the Make Project fails with this error.
Environment: Windows 7 64 bit
Gradle:
trouble writing output: java.security.NoSuchAlgorithmException: SHA-1 MessageDigest not available
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':MyApp:dexDebug'.
Running C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2\dx.bat failed. See output
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I have made sure the Gradle zip was downloaded and installed properly
Any hints what else should I check for?
I was using IBM JDK. Switching to Sun/Oracle JDK fixed the problem.

Resources