我正在尝试使用构建我的项目,fdroid
但是当它到达时它一直失败gradle
。该项目在 android studio 中构建良好,但在 gradle 命令行中总是失败。我多次搜索谷歌,但我无法从任何网站获得帮助。我已将我的设置ANDROID_HOME
为/home/collins/Android/Sdk
但似乎 gradle 忽略了该变量,每次我尝试构建时,我注意到 gradle 生成的local.properties
文件具有错误的 sdk 位置值:
sdk.dir=$ANDROID_HOME
sdk-location=$ANDROID_HOME
我不知道是否有办法为 gradle 中的任何项目设置全局默认值。这是来自的完整日志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
编辑
正如您在上面的错误中看到的那样,/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME
使用了不正确的 sdk 位置,我不知道这个错误来自哪里,因为在 local.properties 文件中设置了不同的值,该值是sdk.dir=$ANDROID_HOME