如何解决React Native中生成失败并出现异常的问题

m1m5dgzv  于 2022-12-14  发布在  React
关注(0)|答案(1)|浏览(141)

这是我面临的错误

BUILD FAILED in 1m 33s

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.bat app:installEmembershipcardDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01    
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01  
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01        
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01        
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01    
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01    
Note: D:\ememberProject\eMembership-React-Native\node_modules\@react-native-community\art\android\src\main\java\com\reactnativecommunity\art\ARTGroupShadowNode.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\@react-native-async-storage\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\@react-native-async-storage\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStoragePackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\react-native-camera\android\src\main\java\com\google\android\cameraview\Camera2.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\@react-native-firebase\messaging\android\src\main\java\io\invertase\firebase\messaging\ReactNativeFirebaseMessagingModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\react-native-html-to-pdf\android\src\main\java\android\print\PdfConverter.java uses or 
overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\react-native-safe-area-context\android\src\main\java\com\th3rdwave\safeareacontext\InsetsChangeEvent.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ememberProject\eMembership-React-Native\node_modules\react-native-share\android\src\main\java\cl\json\RNSharePathUtil.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
e: D:\ememberProject\eMembership-React-Native\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\CustomSearchView.kt: (8, 76): Type mismatch: inferred type is Context? but Context was expected
Note: D:\ememberProject\eMembership-React-Native\node_modules\react-native-svg\android\src\main\java\com\horcrux\svg\VirtualView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* 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 1m 33s

    at makeError (D:\ememberProject\eMembership-React-Native\node_modules\execa\index.js:174:9)
    at D:\ememberProject\eMembership-React-Native\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (D:\ememberProject\eMembership-React-Native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (D:\ememberProject\eMembership-React-Native\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
PS D:\ememberProject\eMembership-React-Native>

这是一个android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
        kotlin_version = '1.7.0'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"

        // 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' }
    }
}

我所尝试的...

  • 我认为解决我几乎试图解决的错误所必需的命令...
  • 而且我已经非常正确地设置了环境设置,正如React Native设置文档所说...
  • 我已经更新了gradle版本,Kotlin版本,React Native版本,npm版本,节点版本等...
  • 我还更新了Firebase应用程序,Firebase消息和Firebase..其中Firebase应用程序和消息版本应该相同...
  • 我还设置了SDK工具,Android SDK在Android工作室...
  • 我已经卸载了节点,vs代码,并再次重新安装它,但再次面临同样的问题iIndiee.构建失败...。
    包.json
"dependencies": {
"@react-native-async-storage/async-storage": "^1.16.0",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^7.1.5",
"@react-native-firebase/app": "^14.12.0",
"@react-native-firebase/messaging": "^14.2.2",
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"android": "^0.0.8",
"axios": "^0.24.0",
"linkify-html": "^3.0.5",
"moment": "^2.29.1",
"react": "17.0.2",
"react-native": "0.69.1",
"react-native-barcode-builder": "^2.0.0",
"react-native-camera": "^4.2.1",
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.11",
"react-native-dots-pagination": "^0.2.0",
"react-native-flash-message": "^0.2.0",
"react-native-floating-action": "^1.22.0",
"react-native-geolocation-service": "^5.3.0-beta.4",
"react-native-gesture-handler": "^2.0.0",
"react-native-gradient-buttons": "^2.0.2",
"react-native-html-to-pdf": "^0.12.0",
"react-native-hyperlink": "^0.0.19",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-linear-gradient": "^2.5.6",
"react-native-marquee": "^0.3.2",
"react-native-material-menu": "^2.0.0",
"react-native-modal": "^13.0.1",
"react-native-open-maps": "^0.4.0",
"react-native-pager-view": "^5.4.9",
"react-native-permissions": "^3.2.0",
"react-native-phone-number-input": "^2.1.0",
"react-native-qrcode-scanner": "^1.5.4",
"react-native-qrcode-svg": "^6.1.2",
"react-native-reanimated": "^2.2.4",
"react-native-render-html": "^6.3.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.14.0",
"react-native-share": "^7.3.5",
"react-native-splash-screen": "^3.3.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "^12.1.1",
"react-native-unimodules": "^0.14.10",
"react-native-uuid": "^2.0.1",
"react-native-viewpager": "^0.2.13",
"react-native-wallet": "^1.0.8",
"react-native-webview": "^11.15.0",
"rn-fetch-blob": "^0.12.0"

},“设备依赖关系”:{“@巴别塔/核心”:“^7.12.9”,“@巴别塔/运行时”:“^7.12.5”,“@React本地社区/eslint配置”:“^2.0.0”,“胡言乱语”:“^26.6.3”,“eslint”:“7.14.0”、“笑话”:“^26.6.3”,“都市React原生巴别预设”:“^0.66.2”,“React测试渲染器”:“17.0.2”},“开玩笑”:{“预置”:“React Native ”}

版本...

PS D:\ememberProject\eMembership-React-Native> npm version
"
  eMembershipCard: '0.0.4',
  npm: '9.1.3',
  node: '19.1.0',
  v8: '10.7.193.20-node.19',
  uv: '1.44.2',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '111',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '8.1.0',
  openssl: '3.0.7+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022e',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'   "
nfzehxib

nfzehxib1#

看起来是你的案子https://github.com/software-mansion/react-native-screens/issues/1449
检查RN和屏幕库react-native-screens@3.14.0react-native@0.69.1的版本

相关问题