My React Native application is unable to execute the npx react-native run-android
command, consistently returning an error related to some ._filename
file, which is automatically created by the system. Is there a way to make Gradlew ignore ._filename
files during the build process?
My stacktrace:
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
I’ve already used the dot_clean .
command to delete the files generated by the operating system, but at this moment, they are being recreated during the build. The error above still occurs even after running the dot_clean .
command in my repository.
2
Answers
Apparently, the issue lies in the latest version of Android Studio Giraffe. On another iMac, I'm using Android Studio Dolphin, and it's working fine, and this error doesn't occur.
Is anyone else experiencing issues with Android Studio Giraffe?
You can try to clean your android project by:
cd {projectname}/android
./gradlew clean
This fixes most of the issues with gradle or any missing config files from android folder.