React Native 构建问题:如何从 Gradlew 构建过程中排除 ._filename 文件?

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

我的 React Native 应用程序无法执行

npx react-native run-android
命令,始终返回与系统自动创建的某些
._filename
文件相关的错误。有没有办法让 Gradlew 在构建过程中忽略
._filename
文件?

我的堆栈跟踪:

ERROR:/project/path/node_modules/@react-native-firebase/app/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar: D8: com.android.tools.r8.internal.sd: Invalid classfile header
com.android.tools.r8.internal.sd: Unexpected class file name: com/learnium/RNDeviceInfo/._BuildConfig.class
    at com.android.tools.r8.internal.ug.w(R8_4.0.48_320a4fe2564c68ad8fe4492fea65872bc8f51e21c4d46e3dbac43afcc38d90de:1180)
(...)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexBuilderDebug'.
> Unexpected class file name: com/learnium/RNDeviceInfo/._BuildConfig.class

* 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 2m 15s
android react-native build-error file-management
1个回答
0
投票

您可以尝试通过以下方式清理您的 Android 项目:

  1. cd {projectname}/android
  2. 奔跑
    ./gradlew clean

这解决了 gradle 的大部分问题或 android 文件夹中任何丢失的配置文件。

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