【发布时间】:2020-08-05 01:53:06
【问题描述】:
我正在为 React Native 应用程序运行 Azure Pipeline 构建,我在其中使用 gradle 进行 android 构建并收到此错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/Users/username/Library/Android/sdk' does not exist.
* 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
BUILD FAILED in 34s
Error: The process '/Users/runner/runners/2.166.3/work/1/s/android/gradlew' failed with exit code 1
at ExecState._setResult (/Users/runner/runners/2.166.3/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.163.0/node_modules/azure-pipelines-task-lib/toolrunner.js:816:25)
at ExecState.CheckComplete (/Users/runner/runners/2.166.3/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.163.0/node_modules/azure-pipelines-task-lib/toolrunner.js:799:18)
at ChildProcess.<anonymous> (/Users/runner/runners/2.166.3/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/2.163.0/node_modules/azure-pipelines-task-lib/toolrunner.js:721:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
##[error]Error: The process '/Users/runner/runners/2.166.3/work/1/s/android/gradlew' failed with exit code 1
Finishing: Gradle
由于我的 ANDROID_HOME=/Users/runner/Library/Android/sdk 不是 ANDROID_HOME=/Users/username/Library/Android/sdk 我通过 YAML 运行脚本检查了它:
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo $ANDROID_HOME
所以,我想知道这个错误可能是什么错误。 我试过了:
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo $ANDROID_HOME
echo "export ANDROID_HOME=/Users/sitefuel-dev/Library/Android/sdk" >> ~/.bashrc
echo "export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools" >> ~/.bashrc
echo $ANDROID_HOME
displayName: 'Script'
这不起作用,如果需要更多详细信息,请在 cmets 中询问。
【问题讨论】:
-
您能否检查一下您是否不小心提交了包含错误 sdk.dir 的 local.properties 文件?
-
让我看看@JarvisLuong
-
它是这样的:sdk.dir=/Users/username/Library/Android/sdk
-
很高兴看到您解决了问题
-
如果您能提供帮助,我遇到了另一个关于 ios 构建的问题。 stackoverflow.com/questions/61365535/…@JarvisLuong
标签: react-native gradle yaml azure-pipelines parse-android-sdk