React Native安卓初始化react-native-zoom-us遇Error=5(unknown),internalErrorCode=124错误
React Native中react-native-zoom-us初始化错误:Error=5 (unknown), internalErrorCode=124
在React Native Cli项目中初始化react-native-zoom-us库时遇到如下错误:
[Error: Error= 5 (unknown), internalErrorCode=124]
已尝试升级React Native或react-native-zoom-us版本,问题依旧,求解决指引。
环境配置详情
buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 24 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' } } apply plugin: "com.facebook.react.rootproject"
初始化及加入会议代码
try { const jwtToken = generateSignature(meetingNumber); await ZoomUs.initialize({ jwtToken, }) .then(result => { console.log(result); try { ZoomUs.joinMeeting({ userName: name, meetingNumber: meetingNumber, password: password, }); } catch (error) { console.error('Failed to join the meeting', error); } }) .catch(error => console.log('Failed to initialize', error)); } catch (error) { console.log(error); }
JWT生成函数
import { KJUR } from 'jsrsasign'; function generateSignature(meetingNumber = '0', role = 0) { const iat = Math.round(new Date().getTime() / 1000) - 30; const exp = iat + 3600; const oHeader = { alg: 'HS256', typ: 'JWT' }; const key = '****'; const secret = '******************'; const oPayload = { sdkKey: key, appKey: key, mn: meetingNumber, role: role, iat: iat, exp: exp, tokenExp: exp, }; const sHeader = JSON.stringify(oHeader); const sPayload = JSON.stringify(oPayload); const sdkJWT = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, secret); return sdkJWT; }
package.json配置
{ "name": "docmoonlight", "version": "1.0.0", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "@notifee/react-native": "^7.8.2", "@react-native-async-storage/async-storage": "^1.22.3", "@react-native-community/datetimepicker": "^7.6.2", "@react-native-community/push-notification-ios": "^1.11.0", "@react-native-firebase/analytics": "^19.0.0", "@react-native-firebase/app": "^19.0.0", "@react-native-firebase/crashlytics": "^19.0.0", "@react-native-firebase/messaging": "^19.0.0", "@react-navigation/bottom-tabs": "^6.5.16", "@react-navigation/drawer": "^6.6.11", "@react-navigation/native": "^6.1.14", "@react-navigation/native-stack": "^6.9.22", "axios": "^1.6.7", "deprecated-react-native-prop-types": "^5.0.0", "geolib": "^3.3.4", "jsonwebtoken": "^9.0.2", "jsrsasign": "^11.1.0", "lodash": "^4.17.21", "moment": "^2.30.1", "prop-types": "^15.8.1", "react": "18.2.0", "react-native": "0.73.5", "react-native-adjust": "^4.37.1", "react-native-calendars": "^1.1304.0", "react-native-callkeep": "^4.3.12", "react-native-date-picker": "^4.3.7", "react-native-device-info": "^10.13.1", "react-native-document-picker": "^9.1.1", "react-native-element-dropdown": "^2.10.1", "react-native-gesture-handler": "^2.15.0", "react-native-get-location": "^4.0.1", "react-native-get-random-values": "^1.11.0", "react-native-image-picker": "^7.1.0", "react-native-modal": "^13.0.1", "react-native-modal-datetime-picker": "^17.1.0", "react-native-notification-sounds": "^0.5.8", "react-native-option-switch": "^1.2.2", "react-native-paper": "^5.12.3", "react-native-permissions": "^4.1.4", "react-native-progress": "^5.0.1", "react-native-reanimated": "3.11.0", "react-native-safe-area-context": "^4.9.0", "react-native-screens": "^3.29.0", "react-native-sectioned-multi-select": "^0.10.0", "react-native-smart-statusbar": "^1.0.24", "react-native-step-indicator": "^1.0.3", "react-native-svg": "^15.0.0", "react-native-table-component": "^1.2.2", "react-native-vector-icons": "^10.0.3", "react-native-voip-push-notification": "^3.3.2", "react-native-zoom-us": "^6.20.0", "toggle-switch-react-native": "^3.3.0", "uuid": "^9.0.1" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.73.21", "@react-native/eslint-config": "0.73.2", "@react-native/metro-config": "^0.73.5", "@react-native/typescript-config": "0.73.1", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "metro-react-native-babel-preset": "^0.77.0", "prettier": "2.8.8", "react-test-renderer": "18.2.0" }, "engines": { "node": ">=18" } }
解决指引
针对internalErrorCode=124错误,核心排查方向围绕JWT签名有效性及参数配置:
- 验证JWT核心参数:
- 确认
key(SDK Key)和secret(SDK Secret)与Zoom开发者后台完全一致,注意区分SDK密钥和API密钥,不要混用。 - 检查
iat(签发时间)和exp(过期时间)的时间戳:iat需设置为当前时间前30秒(避免网络延迟问题),exp不能超过当前时间1小时外,确保时间戳是秒级而非毫秒级。 meetingNumber需与实际会议号完全匹配,格式支持字符串或数字,注意不要包含多余符号。role值需符合逻辑:0为参会者,1为主持人,根据实际角色传递正确值。
- 确认
- 检查JWT签名算法:确保header中的
alg: 'HS256'与签名时使用的算法一致,且签名时使用的是SDK Secret而非其他密钥。 - 解码验证JWT:使用本地工具(如
jsrsasign的解码方法)解析生成的JWT,检查payload字段是否完整、无拼写错误(如mn对应会议号,sdkKey/appKey是否正确)。 - Android配置排查:
- 确认
minSdkVersion(当前24)符合Zoom SDK最低要求(不低于24)。 - 若开启代码混淆,需添加Zoom SDK的混淆规则到
proguard-rules.pro:-keep class us.zoom.** { *; } -keep class com.zipow.** { *; }
- 确认
- 权限检查:确保已申请必要的Android权限(相机、麦克风、网络),虽然初始化错误通常不直接关联权限,但缺失可能导致后续流程异常。
- 版本兼容性验证:查看
react-native-zoom-us@6.20.0的release notes,确认与React Native 0.73.5的兼容性,若存在已知问题,尝试降级到稳定版本(如6.19.x)测试。
内容的提问来源于stack exchange,提问作者Kero Fawzy
相关产品推荐
相关产品推荐

