mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-05 22:56:11 +00:00
Include proguard config (#1842)
This will remove the requirement for people to add the proguard configs themselves. A lot of people first release to production with proguard and then realize why the app crashes. This will solve such issues. This uses android's consumer proguard setting to enable specific proguard config.
This commit is contained in:
23
README.md
23
README.md
@@ -87,29 +87,6 @@ expo install react-native-svg
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Problems with Proguard
|
||||
|
||||
When Proguard is enabled (which it is by default for Android release builds), it causes runtime error.
|
||||
To avoid this, add an exception to `android/app/proguard-rules.pro`:
|
||||
|
||||
```bash
|
||||
-keep public class com.horcrux.svg.** {*;}
|
||||
```
|
||||
|
||||
If you have build errors, then it might be caused by caching issues, please try:
|
||||
|
||||
```bash
|
||||
watchman watch-del-all
|
||||
rm -fr $TMPDIR/react-*
|
||||
react-native start --reset-cache
|
||||
|
||||
Or,
|
||||
|
||||
rm -rf node_modules
|
||||
yarn
|
||||
react-native start --reset-cache
|
||||
```
|
||||
|
||||
### Unexpected behavior
|
||||
|
||||
If you have unexpected behavior, please create a clean project with the latest versions of react-native and react-native-svg
|
||||
|
||||
@@ -54,6 +54,8 @@ android {
|
||||
//noinspection OldTargetApi
|
||||
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||
|
||||
consumerProguardFiles 'proguard-rules.pro'
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
|
||||
1
android/proguard-rules.pro
vendored
Normal file
1
android/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1 @@
|
||||
-keep public class com.horcrux.svg.** {*;}
|
||||
Reference in New Issue
Block a user