我的 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 项目:
cd {projectname}/android
./gradlew clean
这解决了 gradle 的大部分问题或 android 文件夹中任何丢失的配置文件。