rn-fetch-blob is breaking after assemble release

230 Views Asked by At

i am using rn-fetch-blob to download the files to my local directory. npx react-native run-android is running as expected, but after assemble release it fails.

the debug apk is also working.

here is the package.json file

"dependencies": {
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/native-stack": "^6.9.8",
    "axios": "^1.2.2",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-fs": "^2.20.0",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-video": "^5.2.1",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  }

and here is the implementation of the package.

const hanldePress = async () => {
    requestGet(`/getswpvideo?org_id=${envConst.orgID}`).then((res) => {
      if (res?.data?.body) {
        let videoLength = res?.data?.body?.length;
        res?.data?.body?.forEach(async (i) => {
          const nameArr = i.category_name.split("/")
          const name = nameArr.pop();
          if (!await RNFS.exists(`${RNFS.DownloadDirectoryPath}/${envConst.videoFolderName}/${name}`)) {
            const { config, fs, } = RNFetchBlob
           
            let options = {
              fileCache: true,
              addAndroidDownloads: {
                useDownloadManager: true,
                notification: false,
                path: `${RNFS.DownloadDirectoryPath}/${envConst.videoFolderName}/${name}`,
              }
            }
           try {
            await config(options).fetch('GET', i.category_name)
            videoLength--;
           } catch (error) {
            ToastAndroid.show('Something went wrong!!!',ToastAndroid.SHORT);
           }
           
          } else {
            videoLength--;
            if (videoLength === 0) {
              ToastAndroid.show('Download Complete',ToastAndroid.SHORT);
            }
          }
        })
      }
    })
  }

error on android studio logcat: enter image description here

android manifest file enter image description here

0

There are 0 best solutions below