'React Native error Unable to extract native debug metadata
I'm using react-native v0.65.1 and received a lot of errors when generating apk
> Task :app:extractReleaseNativeSymbolTables
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libbetter.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libc++_shared.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libfabricjni.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libfb.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libfbjni.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libfolly_futures.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libfolly_json.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libglog.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libglog_init.so because unable to locate the objcopy executable for the arm64-v8a ABI.
Unable to extract native debug metadata from D:\REACT NATIVE\test-app\test\android\app\build\intermediates\merged_native_libs\release\out\lib\arm64-v8a\libhermes-executor-common-debug.so because unable to locate the objcopy executable for the arm64-v8a ABI.
It is very long but I shorten it as it is all about arm64-v8a ABI. When I installed the generated APK and opened it, it was closing instantly. Have no idea what's going on as the development didn't have any error.
Been researching for 2 days now but still I cannot find anything that can solve this issue. Looking forward to your help. Thank you!
Solution 1:[1]
I managed to find the cause of this issue. I opened my project using android studio (just open the android folder only) and tried running it from there and the emulator was showing
Unable to load script. Make sure you’re either running a Metor service (run ‘react-native start’) or that your bundle ‘index.android.bundle’ is packaged correctly for release.
P/S: The error above didn't show up when I do npx react-native run-android.
Found this very helpful article React Native: Unable to load script: index. android.bundle
What I did was, in the app/build.gradle there is this line project.ext.react and added bundleInRelease: true since I want to generate a released APK. And simply run gradlew assembleRelease from the android folder.
Solution 2:[2]
Had this problem myself, and eventually figured out it was because I didn't hook up the "NDK" correctly.
Steps taken to fix it:
- Android Studio > Tools > SDK Manager > SDK Tools > Select and install "NDK (Side by side)"
This may not be necessary if there is already a version of NDK installed locally. Usually in
~/Android/Sdk/ndk/<versionNumber>/ - In the project, within the file
/android/build.gradle, setndkVersionto the right version:buildscript { ext { // ... ndkVersion = "24.0.8215888" } }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
| Solution 2 | rkok |
