码迷,mamicode.com
首页 > 移动开发 > 详细

SDK Location not found Android Studio + Gradle

时间:2016-03-31 12:55:14      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

extends: http://stackoverflow.com/questions/19272127/sdk-location-not-found-android-studio-gradle

 
I had very similar situation (had a project on another machine and cloned it to my laptop and saw the same issue) and I looked in it.

Error message was coming from Sdk.groovy of Android gradle plugin: https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy

By looking at code, its findLocation needs to set androidSdkDir variable and there are only three ways to do it:

create local.properties file and have either sdk.dir or android.dir line.
have ANDROID_HOME environment variable defined.
System.getProperty("android.home") - I‘m not sure how it works, but it seems like a Java thing.
While your Android Studio knows that the SDK is at that place, I doubt that Android Studio is passing that information to gradle and thus we‘re seeing that error.

I created local.properties file at the project root and put the following line and it compiled the code successfully.


sdk.dir = /Applications/Android Studio.app/sdk/ 

SDK Location not found Android Studio + Gradle

标签:

原文地址:http://www.cnblogs.com/niray/p/5340504.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!