Home > Mobile >  React Native app not running without doing anything in the previous working code
React Native app not running without doing anything in the previous working code

Time:11-05

I am currently woking in a react native projects

It have these packages as dependencies

  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.5",
    "@react-native-community/checkbox": "^0.5.8",
    "@react-native-community/cli": "^7.0.3",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/datetimepicker": "^3.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-picker/picker": "^1.16.3",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/material-top-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.5",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "axios": "^0.21.1",
    "axios-oauth-client": "^1.4.2",
    "axios-token-interceptor": "^0.2.0",
    "moment": "^2.29.1",
    "prop-types": "^15.8.1",
    "react": "17.0.1",
    "react-native": "0.64.1",
    "react-native-animatable": "^1.3.3",
    "react-native-app-intro-slider": "^4.0.4",
    "react-native-calendars": "^1.1264.0",
    "react-native-cardview": "^2.0.5",
    "react-native-date-picker": "^4.2.1",
    "react-native-device-info": "^8.1.3",
    "react-native-eject": "^0.1.2",
    "react-native-geolocation-service": "^5.3.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-get-random-values": "^1.8.0",
    "react-native-image-picker": "^4.0.3",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-modal-datetime-picker": "^10.2.0",
    "react-native-modal-picker": "^0.0.16",
    "react-native-pager-view": "^5.4.23",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-picker-select": "^8.0.4",
    "react-native-reanimated": "^2.2.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.3.0",
    "react-native-searchable-dropdown": "^1.1.3",
    "react-native-signature-canvas": "^4.3.0",
    "react-native-simple-toast": "^1.1.4",
    "react-native-slider": "^0.11.0",
    "react-native-step-indicator": "^1.0.3",
    "react-native-tab-view": "^2.16.0",
    "react-native-text-input-mask": "^3.1.4",
    "react-native-vector-icons": "^9.1.0",
    "react-native-webview": "^11.13.0",
    "react-redux": "^7.2.4",
    "uuid": "^8.3.2"
  },

It is not running now without doing anything with the previous working code, not even updating anything in the system also.

Here is that error

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform react-native-0.71.0-rc.0-debug.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Execution failed for JetifyTransform: /Users/username/.gradle/caches/modules-2/files-2.1/com.facebook.react/react-native/0.71.0-rc.0/7a7f5a0af6ebd8eb94f7e5f7495e9d9684b4f543/react-native-0.71.0-rc.0-debug.aar. > Java heap space

  • Try: 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform react-native-0.71.0-rc.0-debug.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Execution failed for JetifyTransform: /Users/username/.gradle/caches/modules-2/files-2.1/com.facebook.react/react-native/0.71.0-rc.0/7a7f5a0af6ebd8eb94f7e5f7495e9d9684b4f543/react-native-0.71.0-rc.0-debug.aar. > Java heap space

  • Try: 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s

at makeError (/Users/username/Desktop/Gitlab/projectname/node_modules/execa/index.js:174:9)
at /Users/username/Desktop/Gitlab/projectname/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/username/Desktop/Gitlab/projectname/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/Users/username/Desktop/Gitlab/projectname/node_modules/@react-native-community/cli/build/index.js:192:9)

CodePudding user response:

There is some issues in the react-native itself.

solution to this issue, https://github.com/facebook/react-native/issues/35210

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

buildscript {
    // ...
}


allprojects {
    repositories {
        exclusiveContent {
            // We get React Native's Android binaries exclusively through npm,
            // from a local Maven repo inside node_modules/react-native/.
            // (The use of exclusiveContent prevents looking elsewhere like Maven Central
            // and potentially getting a wrong version.)
            filter {
                includeGroup "com.facebook.react"
            }
            forRepository {
                maven {
                    url "$rootDir/../node_modules/react-native/android"
                }
            }
        }
        // ...
    }
}

In android/build.gradle add this exclusiveContent inside the allprojects.repositories.

CodePudding user response:

I am also facing this issue, the last time I built the app, everything worked fine, but just yesterday, the build started failing with this same error. No changes or updates were made.

  • Related