SDK Location not found Android Studio + Gradle

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/ 

时间: 2024-07-29 09:27:09

SDK Location not found Android Studio + Gradle的相关文章

Android Studio Gradle:Resolvedependencies':app:_debugCompile' 问题解决纪录

问题描述: 第一次使用AndroidStudio打开已经存在的AndroidStudio项目,卡在Gradle:Resolvedependencies':app_debugCompile'步骤,即使进入了AndroidStudio界面也无法正常下载Gradle依赖,无法编译运行. 1.首先确认gradle依赖都声明在app下的build.gradle中,而不是在全局项目下的build.gradle文件中,这是使用gradle管理AndroidStudio项目的常识. 2.确认AndroidStu

Android Studio Gradle太慢 解决方案

为了解决Android Studio Gradle太慢这个问题,我们不得不设置下代理来加速Gradle. 用ss,程序员这种动物大多都知道的吧,不解释了.开启ss本地客户端后,依次打开下列菜单   FIle -> Settings -> Appearence&Behavior -> System setting -> HTTP Proxy 如图,填写下信息,保存 保存以后,速度就变快很多了. 这里分享几个免费ss账号的邀请码,如果没有ss账号或客户端的,自行打开 https

转载_加速Android Studio/Gradle构建

转自:加速Android Studio/Gradle构建 随着项目的增大,依赖库的增多,构建速度越来越慢,现在最慢要6分钟才能build一个release的安装包,在网上查找资料,发现可以通过一些配置可以加快速度,这里跟大家分享一下. 开启gradle单独的守护进程 在下面的目录下面创建gradle.properties文件: /home/<username>/.gradle/ (Linux) /Users/<username>/.gradle/ (Mac) C:\Users\&l

[转]加速Android Studio/Gradle构建

加速Android Studio/Gradle构建 android android studio gradle 已经使用Android Studio进行开发超过一年,随着项目的增大,依赖库的增多,构建速度越来越慢,现在最慢要6分钟才能build一个release的安装包,在网上查找资料,发现可以通过一些配置可以加快速度,这里跟大家分享一下. 开启gradle单独的守护进程 在下面的目录下面创建gradle.properties文件: /home/<username>/.gradle/ (Lin

Android studio Gradle 构建

软件需求: 安装gradle 下载gradle压缩包,解压到本地. 设置环境变量,新建系统变量,GRADLE_HOME:E:\installspace\gradle-1.11 path中增加;%GRADLE_HOME%\bin 测试是否成功,命令:gradle -v 安装Android studio(如果用Android studio) 下载:http://developer.android.com/sdk/installing/studio.html,运行安装即可 创建项目 File-New

android开发资源网站,下载各版本SDK源码、Android Studio、NDK等

http://www.androiddevtools.cn/ AndroidDevTools简介 Android Dev Tools官网地址:www.androiddevtools.cn 收集整理Android开发所需的Android SDK.开发中用到的工具.Android开发教程.Android设计规范,免费的设计素材等. 欢迎大家推荐自己在Android开发过程中用的好用的工具.学习开发教程.用到设计素材,欢迎Star.Fork . 如果你对翻译英文的Android开发技术文章感兴趣,欢

Android 使用Android Studio + Gradle 或 命令行 进行apk签名打包

官方文档:https://developer.android.com/tools/publishing/app-signing.html 1. 默认为debug mode,使用的签名文件在: $HOME/.android/debug.keystore 2. Release Mode 签名: build.gradle: android { signingConfigs { releaseConfig { keyAlias 'stone' keyPassword 'mypwd' storeFile

android studio Gradle 配置图文讲解

前边讲解了android studio的基本使用.提到android studio,自然少不了大家关心的gradle.接下来咱们就一起来分析讨论下这个神秘的gradle. 1.构建工具的存在: Gradle和Maven都是项目自动构建工具,编译源代码只是整个过程的一个方面,更重要的是,你要把你的软件发布到生产环境中来产生商业价值,所以,你要运行测试,构建分布.分析代码质量.甚至为不同目标环境提供不同版本,然后部署.整个过程进行自动化操作是很有必要的.于是构建工具应运而生. gradle:一种依赖

Android Studio, gradle and NDK integration

With the recent changes (release 0.7.3 around Dec 27), the new Android Build System starts to be really interesting also if you are using the NDK! Now this is really easy to integrate native libraries in your package and generate APKs for different a