Collins
Collins

Reputation: 145

SDK Location not Found In Gradle Command Line Linux

I am trying to build my project using fdroid but it keeps failing when it gets to gradle. The project builds well in android studio but it always fail in gradle command line. I have search google multiple times but i could not get help from any website. I have set my ANDROID_HOME to /home/collins/Android/Sdk but it seems gradle ignores the variable, Each time i try to build, i noticed that gradle generates a local.properties file with the wrong sdk location value:

sdk.dir=$ANDROID_HOME
sdk-location=$ANDROID_HOME

I don't know if there is a way to set the global default value for any project in gradle. Here is the full log from fdroid build

INFO: Building version 3.0 (3) of com.simpledecredwidget
INFO: Getting source for revision 0ca18981c4b3825861b07e1f2444f711fc8a4fa5
INFO: Creating local.properties file at build/com.simpledecredwidget/local.properties
INFO: Creating local.properties file at build/com.simpledecredwidget/app/local.properties
INFO: Cleaning Gradle project...
ERROR: Could not build app com.simpledecredwidget: Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
==== detail end ====
INFO: Build for app com.simpledecredwidget failed:
Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
==== detail end ====
INFO: Finished.
INFO: 1 builds failed

EDIT
As you can see in the error above, The sdk location /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME was used which was incorrect, i don't know where this bug is coming because a different value was set in local.properties file which value is sdk.dir=$ANDROID_HOME

Upvotes: 0

Views: 727

Answers (0)

Related Questions