SDK Location not found Android Studio + Gradle
2016-03-31 11:32
453 查看
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/
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/
相关文章推荐
- android CoordinatorLayout与滚动的处理
- Android 性能分析工具之 TraceView 使用说明
- Android 单元测试
- 借助Intent实现Android工程中Activity之间Java对象的传递——实现Parcelable接口
- 关于Ali Muzaffar大神的AnimatedEditText的优化
- 地区联动菜单
- 主工程、依赖包、jar包、android.jar、Android Support Library的关系
- android 根据生日生成星座
- Android--BroadcastReceiver应用详解
- 一个Android学习的地方
- Android-Universal-Image-Loader最新框架解析
- $《第一行代码:Android》读书笔记——第1章 Android系统
- gradle androidStudio 学习笔记
- android缓存框架ASimpleCache
- Android开发之利用Intent实现数据传递的方法
- android涉及的设计模式
- Android Studio默认创建的view学习笔记
- android开发命名规范
- Android studio的gradle目录结构
- Android系统开发之四:多线程和Synchronized同步机制