Missing platform-tools when installing Android Stu

2020-07-09 07:11发布

问题:

I am trying to install Android Studio on Mac OSx, with the goal of learning some Android development. The instructions provided were simply to:

1. Launch the .dmg file you downloaded.
2. Drag and drop Android Studio into the Applications folder.
3. Open Android Studio and follow the setup wizard to install any necessary SDK tools.

I get to the setup wizard, select everything, give it 6 gigs of ram when asked, then it proceeds to download components and install. However, at some point a popup appears:

The following SDK component was not installed: platform-tools

The output shows:

Ignoring unknown package filter 'platform-tools'
Installing Archives:
  Preparing to install archives
  Installing Google APIs, Android API 23, revision 1
    Installed Google APIs, Android API 23, revision 1
  Installing Google APIs Intel x86 Atom System Image, Google Inc. API 23, revision 12
    Installed Google APIs Intel x86 Atom System Image, Google Inc. API 23, revision 12
    Updated ADB to support the USB devices declared in the SDK add-ons.
  Stopping ADB server failed (code -1).
  Unable to run 'adb': Cannot run program "/Users/me/Library/Android/sdk/platform-tools/adb": error=2, No such file or directory.
  Starting ADB server failed (code -1).
  Done. 2 packages installed.
Ignoring unknown package filter 'platform-tools'

If I proceed to click "Finish" button, it opens up the Android Studio. But under Preferences -> Appearance & Behavior -> System Settings -> Android SDK, I see an error:

Please specify a Android SDK Location

There is Standalone SDK Tools, but I was under the impression that Android Studio would come with all packages needed to develop in Android:

Note: If you have not yet downloaded the SDK tools, download them now. For a complete IDE and Android SDK package, we recommend downloading Android Studio.

So I'm kinda lost on what things I should be installing. How can I get my Android Studio to 'work' on my Mac?

回答1:

Okay, so I found a solution that works. This Stackoverflow thread was using command-line to update the SDK. I went into my tools/ and ran:

android update sdk -u

That pulled all the necessary SDK components from the server. Once it was done, I was able to point Android Studio to the standalone SDK folder and things seemingly work now.



回答2:

I had the exact same problem on Mac OS X. Here is how I fixed it. Open terminal and use the following commands.

$cd ~/Library/Android/sdk/tools/

$./android update sdk --no-ui --filter 1

It will start the update of package in non-gui mode and ask for permission etc. and finally install well.

** I replied this on another thread as well. But I think this will help everybody because these are all related. I struggled much to find this solution. Depending on search keywords, people will end up in either of these threads.



回答3:

Had similar issue (Android studio 3.0). Happened because I was behind a corporate proxy and the tools were not downloaded during setup.

Solution:

  1. Configure proxy in settings -> HTTP proxy
  2. Re-install Android Studio. proxy configuration will persist and the installation should succeed the second time (got additional window with the tools to download)


回答4:

The android command that many of the above answers use is now deprecated, and may or may not work for recent installations.

I just solved a similar problem to the above (for me the platform-tools package installed, but the installation was missing several files) by running the commands:

cd ~/Library/Android/sdk
tools/bin/sdkmanager --uninstall platform-tools
tools/bin/sdkmanager --install platform-tools

The uninstall step may not be necessary for everyone.



回答5:

I had the same issue today. Check if you have this folder in your SDK directory: [Android/sdk]/platform-tools

If not, you can grab it here: https://dl.dropboxusercontent.com/u/209338/platform-tools.zip



回答6:

If you have already installed Android SDK (following by Android wizard), then add this path /Users/your-user/Library/Android/sdk in the setting under Preferences -> Appearance & Behavior -> System Settings -> Android SDK

If not, please reinstall your Android Studio or download standalone Android SDK at link https://developer.android.com/sdk/installing/index.html?pkg=tools and follow the above step. Default installation Android SDK on your MAC is /Users/your-user/Library/Android/sdk