Ionic 2 Build Process Failure - android

I coded an ionic 2 app and I have tried to run "ionic run android" to build the apk. I keep getting and error. I have tried everything. I came across this question below but as a newbie I truly can for the life of me figure out what I need to do.
Automatically accept all SDK licences
please help.
ERROR LOOKS LIKE THIS
BUILD FAILED
Total time: 1.903 secs
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.
Error: cmd: Command failed with exit code 1 Error output:

Try the following steps:
-Open your terminal and type the following command. on windows make sure you open your command line as administrator
android
-Android SDK Manager should open, If not then you need to fix your sdk path or environment variables.
-Next to the Tab Android 7.0 (API 24) select it FYI(You do not need to download everything only SDK Platform)
-Now you need to download the SDK, Click on Install Packages.... on the bottom right corner
-Once clicked a modal should open. First click on Android SDK License and make sure it is highlighted.
-You should now be given the option to Accept the License, which you can do by clicking on the radio button on the bottom right corner
-Once done you can click the Install button , It may take a while so go outside and stare at the sun.
-I tend to restart my computer or terminal afterwords which makes sure everyone knows there's a new SDK but its not required.

Related

How can I use Cordova without installing Android Studio?

I use an old computer for development, and my current specs doesn't meet Android Studio's System requirements.
I am a newbie, and only know some JS/HTML5. And I'm trying to enable oAuth for Firebase Auth services for Android.
I downloaded the Commandline Tools from https://developer.android.com/studio/ (far at the bottom of the page) and tried to use sdkmanager.bat, but I can't make it accept commands. I added its Path to the Environment variable "path", and then tried using Windows PowerShell. But writing any command will just make it start over again. (maybe it was something foolish of me)
Then I downloaded and installed Gradle.
After that when I write cordova requirements I get the following result:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
No android targets (SDKs) installed!
Gradle: installed C:\Users\Sparsha\Desktop\gradle-6.5-all\gradle-6.5\bin\gradle
Some of requirements check failed
I am not sure how Android SDK installed became true, but Android target is not installed (Don't know how to install).
Also, using cordova build gives me the following results:
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\Sparsha\Desktop\commandlinetools-win-6514223_latest (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.5/userguide/gradle_daemon.html
Process command line: C:\Program Files\Java\jdk1.8.0_251\bin\java.exe -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=IN -Duser.
language=en -Duser.variant -cp C:\Users\Sparsha\Desktop\gradle-6.5-all\gradle-6.5\lib\gradle-launcher-6.5.jar org.gradle.launcher.daem
on.bootstrap.GradleDaemon 6.5
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
* 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
C:\Users\Sparsha\Desktop\gradle-6.5-all\gradle-6.5\bin\gradle: Command failed with exit code 1
Thanks...
Whatever you downloaded from that URL is not needed. That is probably the SDK for Android Studio.
To setup your Cordova tools to develop Cordova apps with either Visual Studio or your favorite text editor like Notepad++, follow this detailed guide which I created earlier.
Let me know if you have any questions.

Why can't I run my Cordova Project in Android?

I am trying to run my Cordova Project in a Android platform on a Mac.
I downloaded Android Studio.
However, whenever I try to run the following command line in terminal
cordova run android
it ends in the following error:
BUILD FAILED
Total time: 1.391 secs
Error: /Users/karel/Cordova Projects/demo/platforms/android/gradlew: 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 25].
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.
Am I missing something?
It works for
cordova run ios
cordova run osx
cordova run browser
How can I accept these terms the message is talking about? I recall accepting to certain terms, at least, when downloading Android Studio.
I am wondering whether I have to install Android SDK separately from Android Studio or something. (I have no experience with Android).
Thanks for your time. Your help would mean a lot.

Android Studio doesn't install SDKs... what?

I'm trying to use Cordova to build a hello world app and after adding ANDROID_HOME variable (You'd be shocked how long that took to figure out) all I keep seeing when building is this:
BUILD FAILED
Total time: 1 mins 6.679 secs Error:
/Users/vladdy/Desktop/laboratory/cordovaBackgroundApp/platforms/android/gradlew:
Command failed with exit code 1 Error output:
FAILURE: Build failed
with an exception.
What went wrong: A problem occurred configuring root project 'android'.
Failed to find target with hash string 'android-25' in: /Users/vladdy/Library/Android/sdk
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Ok fair enough so let's go install it:
Waiting patiently for the install, and same error running cordova build.
I wonder what else we need to install? But look, it seems that Android Studio still has Nougat and 25 available:
Why is Android Studio not installing anything?
I can see why PhoneGap Build is so popular...
Edit:
cordova requirements is now broken reporting the following:
My ~/.bash_profile:
export ANDROID_HOME=/Users/vladdy/Library/Android/sdk/
Requirements?
If you don't need Android Studio, I recommend not downloading it, instead, as #Tom-Esendam also suggest, go for the command-line tool.
Android Studio and Command Line Tool
Direct download link of Command Line Tool for OSX (2017-03-21)
Proxy?
And if your behind a proxy server, don't forget to add it to the settings in the SDK Manager Settings.
What does the different programs and commands?
cordova build doesn't download any SDK's.
cordova prepare appends the necessary SDK files to the cordova build folders.
After download of Command Line Tool:
After unzipping it, set ANDROID_HOME to it's root, so you have:
build-tools
extras
platforms
platform-tools
system-images
tools
catalogs under the root.
Adding SDK's:
Then install SDK's with ./tools/android.
Android SDK Manager downloads the SDK's, so you check what you need and hit OK to download it.
Preparing the build
Make sure all proxy settings are set if your behind a proxy.
Before running cordova build run cordova prepare. This shouldn't be necessary, but least I need to run that even thou cordova build should include that.
I don't know about the mac version. But on windows you have a standalone sdk manager. If there is one on mac try that?

Unable to run Cordova project on Android from IntelliJ

This is my first time to make a web app via cordova. The problem is when I try to run it on android the following error shows up. I believe that I have installed and updated the android SDK to the latest and should have agreed to the license before installing the updates. I've googled around for a clear solution but can not find a simple solution. What procedure and steps should I take to solve this issue? I would love to hear some simple clear tips for dummies like me from you! I would love to hear from you.
* 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 25].
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.
If you install Android SDK through the SDK manager in Android studio, it will prompt you to accept the license agreements. after you do this you should be able to prepare and run your project.

ionic run android failed, error gradle line 64

previously I can compile but after I updated my cordova something happended. I got this error.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Jay\testproject\platforms\android\CordovaLib\cordova.grad
le' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please 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.
I downloaded all the required SDK, what is the problem here?
I had the same problem and this is how I fixed it. I had the build-tools version 20 installed but still was getting this error:
No installed build tools found. Please install the Android build tools
version 19.1.0 or higher.
So I created a directory named 20 within build-tools directory, and copied all the files from sdk\build-tools\android-4.4W\* to sdk\build-tools\20. The problem was fixed!
You will need to do two main things:
Install android build tools
Make them available in your shell, when run the ionic run command.
Installing the build tools (ver 19.1.0)
Open android development studio
Goto: Configure --> SDK Manager --> select "Android SDK Build-Tools
select the checkbox "Show Package details" (bottom right)
review the versions of this package, make sure the 19.1 is selected - u may use newer, but 19.1.0 works.
Click Apply to make the changes / install it
Make the build tools available in your shell environment
Edit ~/.bash_profile by using vi or other shell editor
vi ~/.bash_profile
Add the following lines:
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:~/Software/android-sdk-macosx/tools:~/Software/android-sdk-macosx/platform-tools"
(save the file, and exit)
Editing the file, makes sure that for each login those variables will be available, but as we are already in active session, you need to make it available for the current shell env, run the following:
. ~/.bash_profile
I was stuck with this error for several days, I didn't find any clear explanation
Till I find this link, https://tomspencer.dev/blog/2017/05/30/a-guide-to-installing-cordova-on-windows-10
uninstall gradle, cordova, ionic, and anything related then use the steps in the link above to install them all correctly. that worked with me

Categories

Resources