Where is android_sdk_root? and how do I set it.?

2020-02-02 17:26发布

I set the android_sdk_home variable so that my application could find .android when trying to run. Now I get an error stating that "android_sdk_root is undefined". I am running win 7 with a new installation of Android Studio, inside parallels on a macbook pro.

Thank you for your response. I checked the location and it is identified as the same location as the ANDROID_SDK_HOME environment path. It still says root is undefined. I created an ANDROID_SDK_ROOT enviroment path to the same location and it is still undefined.

标签: android
10条回答
何必那么认真
2楼-- · 2020-02-02 18:03

I received the same error after installing android studio and trying to run hello world. I think you need to use the SDK Manager inside Android Studio to install some things first.

android_sdk_root error

Open up Android Studio, and click on the SDK Manager in the toolbar.

SDK Manager

Now install the SDK tools you need.

  • Tools -> Android SDK Tools
  • Tools -> Android SDK Platform-tools
  • Tools -> Android SDK Build-tools (highest version)

For each Android release you are targeting, hit the appropriate Android X.X folder and select (at a minimum):

  • SDK Platform
  • A system image for the emulator, such as ARM EABI v7a System Image

The SDK Manager will run (this can take a while) and download and install the various SDKs.

Inside Android Studio, File->Project Structure will show you where your Android sdks are installed. As you can see mine is c:\users\Joe\AppData\Local\Android\sdk1.

enter image description here

If I navigate to C:\Users\Joe\AppData\Local\Android\sdk1\sources you can see the various Android SDKs installed there...

SDK Directories

查看更多
家丑人穷心不美
3楼-- · 2020-02-02 18:05

ANDROID_HOME, which also points to the SDK installation directory, is deprecated. If you continue to use it, the following rules apply: If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT. If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used. If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.

查看更多
何必那么认真
4楼-- · 2020-02-02 18:06

in mac os you can try brew install gradle

查看更多
成全新的幸福
5楼-- · 2020-02-02 18:07

You need to make a system env variable with the name: ANDROID_SDK_ROOT and it's value should be C:\Users\your_user_name\AppData\Sdk\tools\bin worked for me

查看更多
迷人小祖宗
6楼-- · 2020-02-02 18:17

In Android Studio 3.2.1 I got this error because I installed a new API(28) level emulator without installing that API SDK components. After I installed SDK platform and SDK platform tools for the API level 28 and updated Android Emulator the emulator started running.

Hope it may help someone.

查看更多
一纸荒年 Trace。
7楼-- · 2020-02-02 18:17

You can just install the portable version, the only solution that worked here.

(If you still did not manage to correct this problem...)

查看更多
登录 后发表回答