Search code examples
react-nativezoom-sdkzoom-meeting

Getting [Error: Error= 5 (unknown), internalErrorCode=124] when initializing react-native-zoom-us library in android


I am encountering an issue while trying to initialize the react-native-zoom-us library in my React Native Cli project. The error message I receive is:

[Error: Error= 5 (unknown), internalErrorCode=124]

Here are the details of my setup:

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"

Code for Initialization and Joining Meeting:

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 Generation Function:

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"
  }
}

Despite my best efforts, I can't seem to resolve the initialization error. Any assistance or guidance on what might be causing this issue would be greatly appreciated.

Even with newer versions of React Native or zoom-us it still same error


Solution

  • Error: Zoom Initialization Fails on Android 9

    Issue: You're encountering the error "Failed to initialize Zoom" on an Android 9 device using react-native-zoom-us. This likely stems from incompatibility with older Android versions.

    Solution: Upgrade Device (Recommended): Test on Android 14 devices for guaranteed Zoom SDK support. and also make sure your credentials is right