How do you do Log when you release Android?

Asked 2 years ago, Updated 2 years ago, 24 views

I thought the log would disappear if I build it during the Android release.

There was an error in the released app, so I looked at it

There's an error in the log

Then should I remove all the log before the release? What do you usually do?

Thank you^

^

android

2022-09-21 23:05

1 Answers

In fact, I use Cotlin, which uses Cotlin's inline function to leave the function blank in the release version so that nothing is called. But this is a function that depends on the kotlin language..

Where to:

debug(TAG, "Hello world!")

implementation (debug):

@Suppress("NOTHING_TO_INLINE")
fun debug(tag: String, message: String) {
    Log.d(tag, message)
}

implementation (release):

@Suppress("NOTHING_TO_INLINE")
fun debug(tag: String, message: String) {
    // emptying
}

It's just for kotlin. If you use Java, I'm sorry I couldn't give you a good answer


2022-09-21 23:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.