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:
I can see why PhoneGap Build is so popular...
cordova requirements
is now broken reporting the following:
My ~/.bash_profile
:
export ANDROID_HOME=/Users/vladdy/Library/Android/sdk/
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)
And if your behind a proxy server, don't forget to add it to the settings in the SDK Manager Settings.
cordova build
doesn't download any SDK's.
cordova prepare
appends the necessary SDK files to the cordova build folders.
After unzipping it, set ANDROID_HOME
to it's root, so you have:
catalogs under the root.
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.
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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.