pratteek shaurya
pratteek shaurya

Reputation: 960

react native apk build fail

I have been trying to make an APK of my react native app, but don't know what problem is causing the APK build to fail. I am using the command gradlew assembleRelease to make APK

Following below I have given information about my app and error, please comment if any more information is required.

package.json:

{

  "name": "appName",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "@react-native-community/datetimepicker": "3.5.2",
    "@react-navigation/native": "5.9.2",
    "@react-navigation/stack": "5.14.2",
    "formik": "^2.2.9",
    "moment": "^2.29.4",
    "react": "17.0.2",
    "react-native": "0.68.2",
    "react-native-confirmation-code-field": "7.2.0",
    "react-native-countdown-component": "^2.7.1",
    "react-native-gesture-handler": "1.9.0",
    "react-native-mask-input": "1.2.1",
    "react-native-modal-selector-searchable": "^2.1.4",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "2.17.1",
    "react-native-svg": "12.1.0",
    "react-native-video": "^5.2.1",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/runtime": "^7.20.13",
    "@react-native-community/eslint-config": "^3.2.0",
    "@types/react": "^18.0.27",
    "@types/react-native": "^0.71.2",
    "babel-jest": "^29.4.1",
    "eslint": "^8.33.0",
    "jest": "^29.4.1",
    "metro-react-native-babel-preset": "^0.75.0",
    "prettier": "^2.8.4",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "17.0.2",
    "typescript": "^4.9.5"
  },
  "jest": {
    "preset": "react-native"
  }
}

error while building APK:

> Task :react-native-screens:generateReleaseRFile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-screens:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-screens:releaseCompileClasspath'.
   > Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
      > Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
        Searched in the following locations:
            https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar

Upvotes: 1

Views: 360

Answers (1)

Fiston Emmanuel
Fiston Emmanuel

Reputation: 4849

This issue was caused by a wrong reference for React Native android artifacts on Maven repository - React Native Core Team already provided the patch - https://github.com/facebook/react-native/issues/35210

Upvotes: 1

Related Questions