azure-devops - ReactNative 移动应用程序的 CI 管道不起作用
问题描述
我们的团队正在使用 React Native 开发一个移动应用程序。我已从 Azure Repo 获取代码并将其克隆到我的本地系统以构建系统一次,然后再开始为其创建 Azure Pipeline。
我按照开发人员的指示在我的系统中安装了以下内容:节点版本 12.8.3 npm 版本 7.6.1 python 2.7.15 JDK 8.0.2410.7
我已经运行了以下命令来构建 android 源代码:
npm install -g react-native-cli
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
package.json 定义了以下脚本:
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
}
现在在我的本地系统中构建成功,我正在为 CI 管道创建一个管道。下面是代码:
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: npm install
displayName: 'Install node dependencies'
- task: Gradle@2
inputs:
workingDirectory: '/android'
gradleWrapperFile: '/android/gradlew'
gradleOptions: '-Xmx3072m'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
tasks: 'assembleRelease'
我从我看到的许多例子中学到的是,Gradle 任务将是捆绑和生成 apk 文件。但是我创建的管道抛出错误,如下所示:
A problem occurred evaluating settings 'MobileApp'.
Could not read script '/home/vsts/work/1/s/MobileApp/node_modules/react-native-unimodules/gradle.groovy' as it does not exist.
这就是我在 settings.gradle 文件中看到的内容:
rootProject.name = 'MobileApp'
apply from: '../node_modules/react-native-unimodules/gradle.groovy'
includeUnimodulesProjects()
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesSettingsGradle(settings)
include ':app'
PS:我最近才开始在 devops 工作。我能够为 Dotnet 服务和 Angular 项目设置管道。但是移动应用程序对我来说很新。
解决方案
推荐阅读
- lua - D/Dlang:Lua 接口,有什么方法可以强制用户无法访问中间对象?
- r - R plotly,将刻度更改为斜体
- css - 如何将 textarea 和 text inut 放在收音机旁边?
- reactjs - gatsby-plugin-transition-link AniLink Cover 选项没有足够快地隐藏上一页
- tensorflow - 如何在 gpflow 中打印输出(张量值、形状)?
- angular - routerLink时如何不绕过必填字段
- pdftables - 是否可以在 PDFTables 包中转换图像 pdf
- php - 用php创建json数组
- java - 检查列是否包含缺失值
- amazon-web-services - 在 lambda 中获取 Cognito 验证码以使用本地提供商发送 SMS