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:
Amit Kumar
2023-01-03 20:29:10 +05:30
committed by GitHub
parent b3dc36ab01
commit 1637580732
3 changed files with 3 additions and 23 deletions

View File

@@ -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

View File

@@ -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
View File

@@ -0,0 +1 @@
-keep public class com.horcrux.svg.** {*;}