logback-android icon indicating copy to clipboard operation
logback-android copied to clipboard

Getting Issue In Android 15

Open pallavi123-collab opened this issue 9 months ago • 3 comments

Describe the bug

Unable to create File app getting crashed in all android 15 devices

Reproduction

Unable to create file in only android 15

Logs

java.lang.RuntimeException: Unable to resume activity {com.mobicule.vodafone.ekyc.client/com.mobicule.vodafone.ekyc.client.FAQ.view.SendLogsActivity}: java.lang.IllegalStateException: FileNamePattern [/data/user/0/com.mobicule.vodafone.ekyc.client/files/logslog-%d{yyyy-MM-dd}-%i.txt] does not contain a valid DateToken at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5721) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5764) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:64) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:60) at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:230) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:112) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:86) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2902) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:282) at android.os.Looper.loop(Looper.java:387) at android.app.ActivityThread.main(ActivityThread.java:9494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1005) Caused by: java.lang.IllegalStateException: FileNamePattern [/data/user/0/com.mobicule.vodafone.ekyc.client/files/logslog-%d{yyyy-MM-dd}-%i.txt] does not contain a valid DateToken at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(Unknown Source:39) at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(Unknown Source:0) at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.start(Unknown Source:129) at com.mobicule.vodafone.ekyc.client.customLogger.CustomLogger.configureLogback(SourceFile:59) at com.mobicule.vodafone.ekyc.client.FAQ.view.SendLogsActivity.onPostResume(SourceFile:39) at android.app.Activity.performResume(Activity.java:9388) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5703) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5764) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:64) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:60) at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:230) at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:112) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:86) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2902) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:282) at android.os.Looper.loop(Looper.java:387) at android.app.ActivityThread.main(ActivityThread.java:9494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1005)

logback-android version

'com.github.tony19:logback-android:3.0.0'

OS Version

android 15 (35)

What logback configuration are you using? (logback.xml or Java/Kotlin code)

logback.xml

Validations

  • [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [x] The provided reproduction is a minimal reproducible of the bug.

pallavi123-collab avatar Apr 03 '25 09:04 pallavi123-collab

This appears to be a minification issue as I can only reproduce it with isMinifyEnabled = true. R8 is stripping out a necessary class (though I have not investigated deeply enough to find out which). Editing my proguard-rules.pro with the following has fixed it:

-keep public class ch.qos.logback.** { *; }
-dontwarn javax.mail.*
-dontwarn javax.mail.internet.*

The dontwarn lines are required to fix an R8 reference error related to the SMTPAppender.

e-hartig avatar Apr 23 '25 19:04 e-hartig

Thank you for supporting its working fine.

On Thu, Apr 24, 2025 at 12:52 AM Evan Hartig @.***> wrote:

e-hartig left a comment (tony19/logback-android#378) https://github.com/tony19/logback-android/issues/378#issuecomment-2825306829

After a bit more investigation, this one line in proguard-rules.pro also works to prevent the crash:

-keep class ch.qos.logback.core.rolling.** { *; }

— Reply to this email directly, view it on GitHub https://github.com/tony19/logback-android/issues/378#issuecomment-2825306829, or unsubscribe https://github.com/notifications/unsubscribe-auth/BRECRRJODZEEI6AHACHNUUD227R7XAVCNFSM6AAAAAB2LV2UT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMRVGMYDMOBSHE . You are receiving this because you authored the thread.Message ID: @.***>

pallavi123-collab avatar Apr 25 '25 04:04 pallavi123-collab

@pallavi123-collab May you provide the content of file logback.xml?

liushuai42 avatar May 22 '25 03:05 liushuai42