Home > Mobile >  Faild to release react-native apk on gradlew assembleRelease
Faild to release react-native apk on gradlew assembleRelease

Time:08-15

Hello guys, this is becoming a serious problem for me. I have been trying to create release apk file from last 2 weeks but I'm unable to do that due to this issue. It works fine on creating bundle i.e. gradlew bundleRelease. It does not throw any error on creating bundle but it failed to create release apk.

package.json file

Here is my package.json file where all my dependencies are located

{
    "name": "edesign",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "start": "react-native start",
        "test": "jest",
        "build": "npx 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/",
        "lint": "eslint ."
    },
    "dependencies": {
        "@react-native-community/cameraroll": "^4.1.2",
        "@react-navigation/drawer": "^6.4.1",
        "@react-navigation/native": "^6.0.10",
        "@react-navigation/native-stack": "^6.6.1",
        "react": "17.0.2",
        "react-devtools": "^4.24.4",
        "react-native": "0.67.3",
        "react-native-admob-next": "^1.2.0",
        "react-native-device-info": "^9.0.2",
        "react-native-fetch-blob": "^0.10.8",
        "react-native-fs": "^2.20.0",
        "react-native-gesture-handler": "^2.4.1",
        "react-native-image-crop-picker": "^0.37.3",
        "react-native-push-notification": "^8.1.1",
        "react-native-reanimated": "^2.8.0",
        "react-native-safe-area-context": "3.4.1",
        "react-native-screens": "^3.13.1",
        "react-native-share": "^7.4.0",
        "react-native-vector-icons": "^9.1.0",
        "react-native-version-check": "^3.4.3",
        "react-native-view-shot": "^3.1.2"
    },
    "devDependencies": {
        "@babel/core": "^7.12.9",
        "@babel/runtime": "^7.12.5",
        "@react-native-async-storage/async-storage": "^1.17.3",
        "@react-native-community/eslint-config": "^2.0.0",
        "@react-native-community/slider": "^4.2.2",
        "@react-native-firebase/app": "^14.9.1",
        "@react-native-firebase/firestore": "^14.9.1",
        "@react-native-firebase/messaging": "^14.9.1",
        "babel-jest": "^26.6.3",
        "eslint": "7.14.0",
        "jest": "^26.6.3",
        "metro-react-native-babel-preset": "^0.66.2",
        "react-native-image-picker": "^4.8.1",
        "react-test-renderer": "17.0.2"
    },
    "jest": {
        "preset": "react-native"
    }
}

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
        googlePlayServicesVersion = " " // default: " "
        firebaseVersion = " " // default: " "
        androidXCore = "1.6.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath 'com.google.gms:google-services:4.3.12'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

Error

  • Related