diff --git a/android/build.gradle b/android/build.gradle index ae48d08..711992a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -12,7 +12,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.2.2' } } } @@ -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 diff --git a/android/logback-rules.pro b/android/logback-rules.pro new file mode 100644 index 0000000..b2acac8 --- /dev/null +++ b/android/logback-rules.pro @@ -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 (()) 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.* { (); } \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index fd899e9..83e5b3b 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -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) diff --git a/example/package-lock.json b/example/package-lock.json index 34a1d5f..3fb9c0c 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -34,7 +34,7 @@ } }, "..": { - "version": "0.5.4", + "version": "0.5.5", "license": "MIT", "devDependencies": { "@babel/preset-env": "^7.19.0", diff --git a/example/package.json b/example/package.json index 9538b4a..2941ad4 100644 --- a/example/package.json +++ b/example/package.json @@ -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",