Skip to content

Commit

Permalink
fix(crash): Fix "does not contain a valid DateToken" crash
Browse files Browse the repository at this point in the history
  • Loading branch information
fdrault committed Aug 19, 2024
1 parent a6e7753 commit 4b59430
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.android.tools.build:gradle:7.2.2'
}
}
}
Expand All @@ -39,6 +39,7 @@ android {
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
versionCode 1
versionName "1.0"
consumerProguardFiles 'logback-rules.pro'
}
lintOptions {
abortOnError false
Expand Down
13 changes: 13 additions & 0 deletions android/logback-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# https://github.com/tony19/logback-android/issues/344
# https://github.com/BeTomorrow/react-native-file-logger/issues/71
#
# @noproxy finding about Proguard enabled making logback-android crash:
#
# AGP enables R8 full mode by default since 8.0.0.
# It affects all logback-android versions.
# And the R8 full mode has some behaviors difference, and the relevant change is:
# The default constructor (<init>()) is not implicitly kept when a class is kept.
#
# This rules prevents crash on release mode Proguard enabled.

-keepclassmembers class ch.qos.logback.core.rolling.helper.* { <init>(); }
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ react {
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false
def enableProguardInReleaseBuilds = true

/**
* The preferred build flavor of JavaScriptCore (JSC)
Expand Down
2 changes: 1 addition & 1 deletion example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"android:release": "react-native run-android --mode=release",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
Expand Down

0 comments on commit 4b59430

Please sign in to comment.