Kotlin DSL:为什么我能够从 Play 商店获取发布版本中的日志?

问题描述 投票:0回答:1

我们没有在发布模式下启用日志记录,但我们可以从商店的发布版本中获取日志。在三星 A32 Android 13 上运行。

buildTypes {
        debug {
            isMinifyEnabled = true
            isShrinkResources = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )

            configure<CrashlyticsExtension> {
                // No need during development, enabling it also prevents Gradle to work offline
                mappingFileUploadEnabled = false
            }

            signingConfig = signingConfigs.getByName("debug")
        }
        release {
            isMinifyEnabled = true
            isShrinkResources = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )

            signingConfig = signingConfigs.getByName("release")
        }
    }

使用 Kotlin DSL 时,我们是否需要显式禁用构建变体中的日志记录?

为了保密,我压缩了日志,但这些日志指向应用程序的包名称。

02:37:01.463  I  ViewPostIme pointer 0
02:37:01.563  I  ViewPostIme pointer 1
02:37:01.581  D  initGoToTop
02:37:01.594  D  [NativeCFMS] BpCustomFrequencyManager::BpCustomFrequencyManager()
02:37:01.631  I  Relayout returned: old=(0,80,1080,2274) new=(28,669,1052,1684) req=(1024,1015)0 dur=10 res=0x3 s={true 0xb400006f071bd800} ch=true seqId=0
02:37:01.632  I  mThreadedRenderer.initialize() mSurface={isValid=true 0xb400006f071bd800} hwInitialized=true
02:37:01.632  D  eglCreateWindowSurface
02:37:01.637  D   onsize change changed 
02:37:01.638  I  reportNextDraw android.view.ViewRootImpl.performTraversals:4438 android.view.ViewRootImpl.doTraversal:3116 android.view.ViewRootImpl$TraversalRunnable.run:10885 android.view.Choreographer$CallbackRecord.run:1301 android.view.Choreographer$CallbackRecord.run:1309 
02:37:01.638  I  Setup new sync id=0
02:37:01.639  I  Setting syncFrameCallback
02:37:01.639  I  registerCallbacksForSync syncBuffer=false
02:37:01.643  I  Received frameDrawingCallback syncResult=0 frameNum=1.
02:37:01.643  I  Setting up sync and frameCommitCallback
android kotlin android-gradle-plugin gradle-kotlin-dsl
1个回答
0
投票

可能是错误的,但您可能需要向您的

proguard-rules.pro
添加 proGuard 规则,例如:

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** e(...);
    public static *** i(...);
    public static *** v(...);
    public static *** w(...);
}

(来源:使用 proguard 删除 Log 调用

© www.soinside.com 2019 - 2024. All rights reserved.