react-native: App build has warning issues "Unable to strip the following libraries"
Description
When I build the simple app only shows “Hello world”, I’ve got the following warning, and the size of my app reaches 32MB.
I used the build command ./gradlew assembleRelease and also used Android Studio. I got the same warning in both cases.
Android Studio has installed the NDK(side by side) to strip these packages.
How can I fix this issue?
> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as
they are: libbetter.so, libc++_shared.so, libevent-2.1.so,
Version
0.66.4
Output of npx react-native info
info Fetching system and libraries information…
System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel® Core™ i5-10210U CPU @ 1.60GHz
Memory: 1.97 GB / 11.85 GB
Binaries:
Node: 14.17.4 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.14 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 4.2.0.0 AI-202.7660.26.42.7351085
Visual Studio: Not Found
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
I created the app with this command.
npx react-native init sample
I installed react-native-geolocation-service.
I build the app with ./gradlew assembleRelease
But I’ve got a warning.
Snack, code example, screenshot, or link to a repository
No response
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 16 (2 by maintainers)
The NDK version set by
ndkVersioninsideandroid/build.gradlemust be installed using Android Studio SDK Tools.ndkVersioninsideandroid/build.gradleandroid/build.gradleand then hit the Apply button.Wait to finish installing and then clean the app with something like
cd android && ./gradlew clean && cd ..and then rebuild it.This fixed this issue for me and there are no “Unable to strip the following libraries” errors any more after clean builds.
Like people don’t have anything better to do and they just come back to issues and recreate them. No, I will not create an issue that was existing not resolved and closed blindly. If you don’t care why should I.
If you are using Gradle build tools version 4 or higher, adding android:extractNativeLibs=“true” to application as per android documentation, may solve the issue.
https://developer.android.com/studio/releases/gradle-plugin#extractNativeLibs
用命令–info 查看原因,一般是ndkVersion 不匹配,strip tools找不到
bash gradlew assembleRelease --infoadd this to your app build gradle
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.