I am using CircleCI to send APK to QA testers via AppCenter, but when I've upgraded to the RN 0.72 the build is always failing my confi.yml is:
version: 2.1
jobs:
node:
working_directory: ~/driver-app
docker:
- image: circleci/node:lts
steps:
- checkout
- restore_cache:
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
- run: yarn install --ignore-engines
- save_cache:
paths:
- node_modules
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
- run:
name: Decrypt env file
command: openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -pass pass:$ENCRYPT_SECRET_KEY -d -p -in encrypted-env-staging -out .env
- persist_to_workspace:
root: ~/driver-app
paths:
- node_modules
android-build:
working_directory: ~/driver-app/android
docker:
- image: circleci/android:api-30-node
environment:
APP_VERSION: "2.3.8"
steps:
- checkout:
path: ~/driver-app
- attach_workspace:
at: ~/driver-app
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- save_cache:
paths:
- .gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Decrypt env file
command: openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -pass pass:$ENCRYPT_SECRET_KEY -d -p -in ~/driver-app/encrypted-env-staging -out ~/driver-app/.env
- run:
name: Decrypt google-services.json
command: openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -pass pass:$ENCRYPT_SECRET_KEY -d -p -in app/encrypted-google-services -out app/google-services.json
- run:
name: Decrypt production keystore
command: openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -salt -d -p -in app/encrypted-tkyr-keystore -out app/tkyrkey.keystore -pass pass:$ENCRYPT_SECRET_KEY
- run:
name: Change the .gradlew permission
command: chmod +x ./gradlew
- run:
name: Assemble Release APK
command: ./gradlew assembleRelease -PMYAPP_UPLOAD_STORE_FILE=tkyrkey.keystore -PMYAPP_UPLOAD_KEY_ALIAS=$MYAPP_UPLOAD_KEY_ALIAS -PMYAPP_UPLOAD_STORE_PASSWORD=$MYAPP_UPLOAD_STORE_PASSWORD -PMYAPP_UPLOAD_KEY_PASSWORD=$MYAPP_UPLOAD_KEY_PASSWORD
- run:
name: Rename the APK
command: mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/test_driver_app_v$APP_VERSION.apk
- run:
name: Install appcenter cli
command: sudo npm install appcenter-cli -g
- run:
name: Distribute APK to testers
command: appcenter distribute release --debug --app hhmem-tkyr.net/TkyrCaptain --file app/build/outputs/apk/release/test_driver_app_v$APP_VERSION.apk --group "App Testers" --token $APPCENTER_CLI_TOKEN
- run:
name: Remove secrets
command: rm -rf app/google-services.json ~/driver-app/.env.staging app/tkyrkey.keystore
workflows:
build-android-workflow:
jobs:
- node:
filters:
branches:
only:
- test
- android-build:
requires:
- node
filters:
branches:
only:
- test
Before I upgrade the RN Library the build is successful, but once I've upgraded to the v0.72 the issue has been appeared.
The failure reason is:
FAILURE: Build failed with an exception.
Where: Script '/home/circleci/driver-app/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 389
What went wrong: A problem occurred evaluating script.
React Native needs Node.js >= 16. You're currently on version v14.17.5. Please upgrade Node.js to a supported version and try again.
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.
BUILD FAILED in 8s
Exited with code exit status 1
I am able to find a solution to this issue, which is to add another command to install the desired NodeJS version V16 using the n
node version manager.
- steps:
...
- run: sudo n 16
...