Android Studio - How to Change Android SDK Path

2018-12-31 05:33发布

When I open Android SDK Manager from Android Studio, the SDK Path displayed is:

\android-studio\sdk

I want to change this path. How do I do it?

30条回答
闭嘴吧你
2楼-- · 2018-12-31 06:04

I'm guessing from the responses that people aren't understanding your question... If I'm right in that you want to have ~\Desktop\github\ then changing the SDK location isn't what you're after.

From Android Studio 3.2.1: From the new project dialog, choose Configure -> Preferences -> Tools -> Terminal -> Start Directory

Put the folder you want as your project default in the field.

e.g. Mine is set to ~/Desktop/github/ since all my work is in ~/Desktop/github/

查看更多
一个人的天荒地老
3楼-- · 2018-12-31 06:05

From the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.

查看更多
与风俱净
4楼-- · 2018-12-31 06:06

Changing the sdk location in Project Settings will solve the problem partially. When Android Studio is used to download a new SDK, it will place the new SDK in the internal SDK folder (inside Android Studio).

Existing android developers will already have a large sdks folder (hereinafter referred to as external SDK folder) containing all the SDKs downloaded before Android Studio came around.

For Mac/Linux users though there is a good way out. Soft links!

Exit Android Studio and perform the following steps:

cp -r <Android Studio>/sdk/ <external SDK folder>/
cd <Android Studio>/
mv <Android Studio>/sdk/ mv <Android Studio>/sdk.orig
ln -s <external SDK folder>/ sdk

And we're good to go. Launch SDK Manager after starting Android Studio, watch as it discovers all your existing SDKs like a charm :).

查看更多
大哥的爱人
5楼-- · 2018-12-31 06:06

I noticed that the latest version of Android Studio doesn't seem to have the option "SDKs" path that's mentioned in many of the answers. I'm guessing that disappeared in one of the updates, somewhere down the line?

The way i solved this issue (osx) was:

  1. Go to Project Settings (Cmd + ;)
  2. In SDK Location make sure you're pointing to the correct SDK location (typically /Applications/Android Studio.app/sdk) then hit Apply
  3. Most important step - hit "Sync Project with Gradle files"

I wasn't doing Step 3 and that was throwing me off. After a sync all your source r belong to us....

查看更多
人气声优
6楼-- · 2018-12-31 06:06

In Android studio 1.2.2 you can simply changes project based SDK, Steps:

  1. Right click on Module and select Open module setting or press F12
  2. Select SDK location from left hand side
  3. Now you can change SDK location as well as JDK location from this page
查看更多
伤终究还是伤i
7楼-- · 2018-12-31 06:07

You can also create the environment variable (in Windows) ANDROID_HOME to the location of the Android SDK and Android Studio will use that.

查看更多
登录 后发表回答