问题描述:

已经安装了android-sdk 和gradle环境,并配置了环境变量,如下所示:

android环境

root@wangju-HP--G4:/home/wangju/Desktop/5i5j_android/AppFrameWork# adb version
Android Debug Bridge version 1.0.
Version 29.0.-
Installed as /usr/local/android-home/android-sdk-linux/platform-tools/adb

gradle环境:

root@wangju-HP--G4:/home/wangju/Desktop/5i5j_android/AppFrameWork# gradle -version

------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------ Build time: -- :: UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c Groovy: 2.4.
Ant: Apache Ant(TM) version 1.9. compiled on February
JVM: 1.8.0_211 (Oracle Corporation 25.211-b12)
OS: Linux 4.15.--generic amd64

在android项目的app目录下执行gradle clean/tasks命令时会报如下错误:

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
> Must apply 'com.android.application' first! * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org

解决办法:

根据错误提示

 SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

翻译过来的意思就是:没有找到sdk,可以在local.properties这个文件中定义android_home,即指明android sdk的所在位置

在app目录下新建local.properties文件,文件内容如下所示:

/usr/local/android-home/android-sdk-linux 是我android sdk的安装目录

sdk.dir=/usr/local/android-home/android-sdk-linux

配置好后,再用gradle clean即可

参考文档:

https://blog.csdn.net/cocos2dx_3_0/article/details/51235732



SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.的更多相关文章

  1. mac android studio 出现 Error: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

      Error: SDK location not found. Define location with sdk.dir in the local.properties file or with a ...

  2. Eclipse导入Gradle时报错:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable

    百度查到http://stackoverflow.com/questions/19794200/gradle-android-and-the-android-home-sdk-location 按照其 ...

  3. DK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME

    根据提示,我们可以新建一个项目或者以前自己使用过没问题的工程,从中把local.properties文件copy到我们从github中想要导入的工程中,我自己就是这样的,然后这个问题就解决了. ndk ...

  4. SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID

    如题: SDK location not found. Define location with sdk.dir in the local.properties file or with an AND ...

  5. 【已解决】mac上appium报错:“Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path”

    按照网上教程配置完appium环境后,真机跑自动化过程,遇到如下报错: appium报错如下: [ADB] Checking whether aapt is present [ADB] The AND ...

  6. Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path

    写case写好好哒,突然debug的时候就冒出这个错误: selenium.common.exceptions.WebDriverException: Message: An unknown serv ...

  7. Appium问题解决方案(7)- Could not find 'adb.exe' in PATH. Please set the ANDROID_HOME environment variable with the Android SDK root directory path

    背景:运行代码提示找不到ADB An unknown server-side error occurred while processing the command. Original error: ...

  8. window.top.location.href 和 window.location.href 的区别

    "window.location.href"."location.href"是本页面跳转. "parent.location.href" 是 ...

  9. 关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法

    location.href 和 window.location.href 区别: 1.location.href 可以直接跳转其他地址(不属于本项目) 也可以跳转本项目中的 2.window.loca ...

随机推荐

  1. (十三)Linux sysfs device_attribute

    /*************************************************************************** * Linux sysfs device_at ...

  2. markdown实现点击链接下载文件

    今天用Markdown工具,需要实现一个点连接下载文件的功能,看起来很多简单我也没多想就直接写了,并且单个页面测试的时候也挺正常,就发布了,但是发布后使用的时候发现问题了,浏览器中直接点击链接没反应, ...

  3. 论文笔记:Unsupervised Domain Adaptation by Backpropagation

    14年9月份挂出来的文章,基本思想就是用对抗训练的方法来学习domain invariant的特征表示.方法也很只管,在网络的某一层特征之后接一个判别网络,负责预测特征所属的domain,而后特征提取 ...

  4. 把所有时间用来做你最应该做的事,用尽全力竭尽所能成为DL and NLP大神。

    两段代码,JAVA and CPP,输出相同结果: #include "stdafx.h" #include <iostream> using namespace st ...

  5. codeforces 576C Points on Plane 相邻两点的欧拉距离

    题意:给出n个点,要求排序后,相邻两点的欧拉距离之和小于等于2.5e9做法:由于0≤ xi, yi ≤ 1e6,所以可以将x<=1000的点分成一份,1000<x<=2000的点分成 ...

  6. springboot2.1.7整合Druid

    一.maven的依赖:文中就贴重点的, 其他依赖就不贴了 <dependency> <groupId>com.alibaba</groupId> <artif ...

  7. binlog2sql快速闪回

    https://github.com/danfengcao/binlog2sql 一.说明: DML(data manipulation language):       它们是SELECT.UPDA ...

  8. 报表开发工具!DevExpress Reporting v19.1:WPF/Web平台报表

    行业领先的.NET界面控件DevExpress Reporting全新发布了v19.1版本,本文主要为大家介绍WPF.Web平台中DevExpress Reporting发布的一些新功能及增强部分功能 ...

  9. Acwing-203-同余方程(扩展欧几里得)

    链接: https://www.acwing.com/problem/content/205/ 题意: 求关于x的同余方程 ax ≡ 1(mod b) 的最小正整数解. 思路: 首先:扩展欧几里得推导 ...

  10. 关于.Net中Process和ProcessStartInfor的使用

    本文主要是介绍在.Net中System.Diagnostics命名空间下Process类和ProcessStartInfo类的使用 用于启动一个外部程序所使用的类是Process,至于ProcessS ...