应用程序react-native在本地工作但无法生成APK(ninja:错误:100次尝试后清单'build.ninja'仍然脏)

问题描述 投票:0回答:1

运行 gradlew bundleRelease 命令生成 APK 时,我在提示符下收到以下错误:

C:\Users\natha\OneDrive\Documentos\WorkspaceNathan\mob-t\gvpmobile\android>gradlew bundleRelease

> Configure project :react-native-reanimated
No AAR for react-native-reanimated found. Attempting to build from source.
Android gradle plugin: 7.3.1
Gradle: 7.5.1
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

**Has codes in the middle**

  ninja: error: manifest 'build.ninja' still dirty after 100 tries


* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* 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 35s
139 actionable tasks: 7 executed, 132 up-to-date

我的 android/app/build.gradle 文件在图像中显示以下错误:

android/app/build.gradle

我的node_modules/@react-native-community/cli-platform-android/native_modules.gradle 文件在图像中显示以下错误:

node_modules/@react-native-community/cli-platform-android/native_modules.gradle

node_modules/@react-native-community/cli-platform-android/native_modules.gradle

node_modules/@react-native-community/cli-platform-android/native_modules.gradle

当我运行 npx react-native run-android 在模拟器上运行应用程序时,它可以正常工作,但出现以下警告:

Prompt

我尝试了多种方法来生成APK,但我不能,我在项目中使用React-native 0.71版本,没有typescript。

下面我留下我的package.json文件来告知依赖项的版本:

{
  "name": "gvpmobile",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.19.2",
    "@react-native-picker/picker": "^2.4.10",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "react": "18.2.0",
    "react-native": "0.71.0",
    "react-native-gesture-handler": "^2.12.1",
    "react-native-gradle-plugin": "^0.71.19",
    "react-native-reanimated": "^3.4.2",
    "react-native-safe-area-context": "^4.7.1",
    "react-native-screens": "^3.24.0",
    "styled-components": "^6.0.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/preset-env": "^7.14.0",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^3.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.1",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.73.5",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "jest": {
    "preset": "react-native"
  }
}

我使用react-native构建了一个应用程序,该应用程序可以在模拟器上本地运行,但不允许我使用gradlew bundleRelease命令生成APK。我需要生成此 APK 才能将应用程序上传到 Play 商店。

密钥库密钥已生成。

react-native build.gradle apk
1个回答
0
投票

如果遇到问题,请解决“react-native-reanimated”库的卸载问题,并从导出器中删除培训资产。Windows 环境中的问题que d'autres 支持 n'ont pas ce 问题。

Au cas où essaye de copier ton dossier contenant le projet et migre le vers c:/nouveau_dossier/nom_projet puis colle et normalement windows te dira qu'un sous dossier (librairie) de ton projet a un nom trop long (dans mon cas il s'agit de react-naitve-reanimated) 卸载并重新构建 avec --warning-mode=all --stacktrace

© www.soinside.com 2019 - 2024. All rights reserved.