我们的团队正在开发一个使用Reactive原住民的移动应用程序。在开始为Azure Repo创建Azure管道之前,我已经将Azure Repo的代码克隆到本地系统构建了一次系统。
我已经按照开发人员的指示在我的系统中安装了以下内容:NoteVersion12.8.3 NPMVersion7.6.1python2.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'我觉得多个错误是全部,而不仅仅是设置文件。当我在本地系统中运行构建时,它运行得很好。但当我运行管道时,它显示出了所有的问题。感谢您对此的任何投入。
记者:我最近才开始在神职人员那里工作。我能够为Dotnet服务和able项目设置管道。但是移动应用对我来说是很新的。
发布于 2022-10-13 19:20:56
添加此步骤后分级任务
- task: PublishBuildArtifacts@1
displayName: 'Publish APK to artifacts'
inputs:
PathtoPublish: 'packages/abc-mobile/android/app/build' #mention your path
ArtifactName: 'android'
publishLocation: 'Container'https://stackoverflow.com/questions/67114343
复制相似问题