AndroidStudioDolphin2021.3.1中无法显示Timber日志。
创始人
2024-10-11 08:00:40
0
  1. 确保在 app 的 build.gradle 文件中已添加 Timber 库的依赖:
dependencies {
     implementation 'com.jakewharton.timber:timber:5.0.1'
 }
  1. 在 Application 类中初始化 Timber:
import timber.log.Timber;

public class MyApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }
    }
}
  1. 在代码中使用 Timber 记录日志:
import timber.log.Timber;

public class MyActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Timber.d("onCreate called.");
    }
}

如果仍然无法显示 Timber 日志,请尝试在 Android Studio 的 Logcat 窗口中选择“NO FILTERS”,然后输入关键字“Timber”并点击搜索按钮。

相关内容

热门资讯

透视规律!wpk安卓下载辅助,... 透视规律!wpk安卓下载辅助,拱趴大菠萝有挂吗(透视)有挂教程(真实有挂)-哔哩哔哩1、透视规律!w...
透视安卓版!wepoker私人... 透视安卓版!wepoker私人局外卦,拱趴大菠萝开挂方法(透视)透视教程(有挂辅助)-哔哩哔哩运拱趴...
据公告内容!hhpoker的辅... 据公告内容!hhpoker的辅助是真的吗,哈糖大菠萝破解器(透视)详细教程(讲解有挂)-哔哩哔哩1、...
透视规律!大菠萝789辅助器下... 透视规律!大菠萝789辅助器下载,hhpoker德州辅助(透视)开挂教程(真实有挂)-哔哩哔哩1、很...
据文件显示!wepoker透视... 据文件显示!wepoker透视脚本苹果版,如何下载wpk透视版(透视)详细教程(有挂方法)-哔哩哔哩...
今天下午!智星德州插件2024... 今天下午!智星德州插件2024最新版,wepoker透视脚本网页(透视)推荐教程(新版有挂)-哔哩哔...
现有说明如下!aapoker辅... 现有说明如下!aapoker辅助工具安全吗,wepoker分析(透视)科普教程(新版有挂)-哔哩哔哩...
反观!wpk模拟器是什么,we... 反观!wpk模拟器是什么,wepoker辅助软件视频(透视)有挂教程(有挂详细)-哔哩哔哩1、wep...
事发当天!wepoker高级辅... 事发当天!wepoker高级辅助,cloudpoker辅助(透视)了解教程(有挂详细)-哔哩哔哩1、...
透视有挂!来玩app破解版,哈... 透视有挂!来玩app破解版,哈糖大菠萝能开挂吗(透视)曝光教程(有挂方法)-哔哩哔哩1、这是跨平台的...