解
我通过帮助@LeoCavalcante解决了这个问题。
问题是在命令控制台中使用gradlew
字时,它可以直接运行。因为,在使用gradlew
时,Windows控制台会运行gradlew.bat
!
请勿尝试使用cygwin(linux)bash命令,例如sh ./gradle :Exam...
或sh gradle :Exam..
或bash gradle :Exam...
只需使用gradlew :Examples:UIExplorer:android:app:installDebug
我无法从反应本地官方回购中构建UIExplorer示例。
我使用Windows和cygwin64。
我已经设置了SDK和NDK。然后克隆了repo并在react-native的根目录中提供了npm install
命令,该目录刚刚被克隆。我添加了local.properties
文件,该文件指定了sdk.dir
和ndk.dir
路径。
当我尝试sh ./gradlew :Examples:UIExplorer:android:app:installDebug
命令时,控制台给出了如下输出;
当我尝试使用--debug
参数的命令时,控制台输出变得太长。但错误行如下;
08:07:50.341 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Running model element 'tasks.validateDebugSigning' rule action Project.<init>.tasks.validateDebugSigning()
08:07:50.347 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Mutating tasks.validateDebugSigning using Project.<init>.tasks.validateDebugSigning()
08:07:50.354 [DEBUG] [org.gradle.model.internal.registry.DefaultModelRegistry] Transitioning model element 'tasks.validateDebugSigning' to state ProjectionsDefined.
08:07:50.389 [ERROR] [org.gradle.BuildExceptionReporter]
08:07:50.402 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
08:07:50.409 [ERROR] [org.gradle.BuildExceptionReporter]
08:07:50.414 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
08:07:50.420 [ERROR] [org.gradle.BuildExceptionReporter] Task '.' not found in root project 'react-native'.
08:07:50.425 [ERROR] [org.gradle.BuildExceptionReporter]
08:07:50.429 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
08:07:50.436 [ERROR] [org.gradle.BuildExceptionReporter] Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace.
08:07:50.443 [LIFECYCLE] [org.gradle.BuildResultLogger]
08:07:50.449 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
08:07:50.456 [LIFECYCLE] [org.gradle.BuildResultLogger]
08:07:50.461 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 2 mins 25.343 secs
我如何克服这个问题?
答案 0 :(得分:1)
该等级认为单个选项:Examples:UIExplorer:android:app:installDebug
是一系列选项。
尝试运行:bash gradlew ":Examples:UIExplorer:android:app:installDebug"