简体   繁体   中英

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

  1. Make sure all proxy settings are set if your behind a proxy.
  2. 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?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM