React原生apk构建失败

bkhjykvo  于 2023-02-13  发布在  React
关注(0)|答案(1)|浏览(230)

我一直在尝试制作react原生应用的APK,但不知道是什么问题导致APK构建失败。我正在使用gradlew assembleRelease命令制作APK
下面我已经给出了我的应用程序和错误的信息,请评论,如果需要更多的信息。
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"
  }
}

构建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
kcrjzv8t

kcrjzv8t1#

此问题是由Maven存储库中React Native android构件的错误引用引起的- React Native Core Team已提供补丁-https://github.com/facebook/react-native/issues/35210

相关问题