5

I am new user of Android Studio and I have serious problem with trying to import Android Studio project to Android Studio on other PC. In general, my Gradle doesn't want to build the project and it is caused by problem with path.

Error log:

Failed to import Gradle project: Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Build file 'E:\Projects\MenuMenu\EventGame\build.gradle' line: 1
A problem occurred evaluating project ':EventGame'.
A problem occurred evaluating project ':EventGame'.
The SDK directory 'E:\Program Files (x86)\Android\android-studio\bin' does not exist

My Android-Studio SDK is in directory:

E:\Program Files (x86)\Android\android-studio\sdk

I found from various posts with similar problems that you can change path to sdk in local.properties file. Mine looks currently like that:

sdk.dir=

So it's empty, but still default path is SOMEHOW set to "E:\Program Files (x86)\Android\android-studio\bin" and I have no idea how to change it. If i try to add to sdk.dir real path the error is the same but the path in error looks like that.

The SDK directory 'E:\Program Files (x86)\Android\android-studio\bin"E:\Program Files (x86)\Android\android-studio\sdk"' does not exist

In 90% of causes I could find via the net people were solving the problem by adding: sdk.dir=/Applications/Android Studio.app/sdk

But then directory is set to E:\Program Files (x86)\Android\android-studio\bin\Applications\Android Studio.app\sdk and something like that doesn't exist in my PC.

Do you have any idea how to solve this problem. Is there any way to change this default path? I also get error:

E:\Projects\MenuMenu\EventGame\build.gradle
Gradle: A problem occurred evaluating project ':EventGame'.
> The SDK directory 'E:\Program Files (x86)\Android\android-studio\system\compile-server' does  not exist.

Thats how my folders looks like: https://www.dropbox.com/s/ikj63gmyfax8z4u/folders.png

4

3 回答 3

4

The easiest and imho the cleanest way to do this is not to set the directory by code, but with an enviroment variable in Windows:

  • Press Win + Pause Key together to see the system information
  • Click on Advanced systems settings (or similar..i don't know the exact english translation)
  • Select the Advanced Tab and on the bottom click on "enviroment variables"
  • Another window pops up where you click on the "New..." Button in the lower half of the window (The system variables area)
  • Name the Variable ANDROID_HOME and paste the path to your SDK as value (in your case E:\Program Files (x86)\Android\android-studio\sdk)
  • save and close everything

If you have a command line window open then close this as well and reopen cmd.exe if you want to use ANDROID_HOME within the command line.

于 2013-08-21T18:23:48.263 回答
3

好的,一般问题是由于该项目是从安装在 Mac 上的 Android-Studio 导入的。斜线方向相反,不知何故程序无法覆盖默认方向,因为他无法理解路径。

于 2013-07-16T14:40:57.087 回答
0

右下角有一个显示类型图标,点击它然后点击左侧的gradle,然后点击图标刷新它。你应该有网络连接。它将下载一个小文件,大约 50kb。这对我有用。

于 2014-01-11T21:38:34.177 回答