From 0682c7e5c5436b74d24a9f156cace646a0834fdf Mon Sep 17 00:00:00 2001 From: dongliang Date: Thu, 7 May 2026 19:00:34 +0930 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=89=93=E5=8C=85=E5=89=8D=E6=B8=85?= =?UTF-8?q?=E7=90=86=EF=BC=88Timber=20release=E5=85=B3=E9=97=AD=20+=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=86=85=E7=BD=91TODO=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Timber.DebugTree 只在 DEBUG 模式植入,release 不输出日志 2. 删除 build.gradle.kts 中的内网 IP 注释 Co-Authored-By: Claude Opus 4.6 (1M context) --- app/build.gradle.kts | 1 - app/src/main/java/com/xiaoqu/watch/app/WatchApplication.kt | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2f6d351..5265e27 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,7 +21,6 @@ android { buildTypes { debug { - // TODO: 内网测试时改回 http://192.168.1.181:8091/ buildConfigField("String", "SERVICE_URL", "\"https://app.updatexiaoqu.com:9443/\"") // MQTT TCP 连接地址(端口 1883 在 MqttConfig 中定义) buildConfigField("String", "MQTT_HOST", "\"mqtt.ququbranch.com\"") diff --git a/app/src/main/java/com/xiaoqu/watch/app/WatchApplication.kt b/app/src/main/java/com/xiaoqu/watch/app/WatchApplication.kt index f599d45..fc8e9db 100644 --- a/app/src/main/java/com/xiaoqu/watch/app/WatchApplication.kt +++ b/app/src/main/java/com/xiaoqu/watch/app/WatchApplication.kt @@ -1,6 +1,7 @@ package com.xiaoqu.watch.app import android.app.Application +import com.xiaoqu.watch.BuildConfig import dagger.hilt.android.HiltAndroidApp import org.conscrypt.Conscrypt import timber.log.Timber @@ -25,8 +26,10 @@ class WatchApplication : Application() { // 解决 Android 8.1 设备连阿里云 OSS 等服务器 TLS 握手失败的问题 Security.insertProviderAt(Conscrypt.newProvider(), 1) - // 2. Timber 日志初始化 - Timber.plant(Timber.DebugTree()) + // 2. Timber 日志(release 不输出,防止信息泄漏) + if (BuildConfig.DEBUG) { + Timber.plant(Timber.DebugTree()) + } // 3. 崩溃处理器(记录日志 + 杀进程,系统自动重启 Launcher) CrashHandler(this).init()