Problem Description:
And the android-sdk gradle environment is installed and configured environment variables, as follows:
android environment
root@wangju-HP-348-G4:/home/wangju/Desktop/5i5j_android/AppFrameWork# adb version
Android Debug Bridge version 1.0.41
Version 29.0.5-5949299
Installed as /usr/local/android-home/android-sdk-linux/platform-tools/adb
gradle environment:
root@wangju-HP-348-G4:/home/wangju/Desktop/5i5j_android/AppFrameWork# gradle -version
------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------
Build time: 2018-02-28 13:36:36 UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_211 (Oracle Corporation 25.211-b12)
OS: Linux 4.15.0-72-generic amd64
Execution gradle clean android app directory under the project / tasks will be reported the following error when the command:
* 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
Solution:
According to error
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Sdk location is not found, you can define android_home local.properties in this document that specifies android sdk: the translation of the meaning
In app directory new local.properties files , file contents as follows:
/ Usr / local / android-home / android-sdk-linux is my android sdk installation directory
sdk.dir=/usr/local/android-home/android-sdk-linux
Once configured, you can then gradle clean
Reference documents:
https://blog.csdn.net/cocos2dx_3_0/article/details/51235732