问题描述
我们的团队正在使用 React Native 开发移动应用。在开始为其创建 Azure Pipeline 之前,我已从 Azure Repo 获取代码并将其克隆到我的本地系统以构建系统一次。
我已按照开发人员的指示在我的系统中安装了以下内容: 节点版本 12.8.3 npm 版本 7.6.1 蟒蛇 2.7.15 京东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 项目设置管道。但移动应用对我来说还很陌生。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)