File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed
Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 1212
1313* [ 设置显示所有应用打印的日志] ( #设置显示所有应用打印的日志 )
1414
15+ * [ 我如果要在线上使用这个库该怎么办] ( #我如果要在线上使用这个库该怎么办 )
16+
1517#### Logcat 入口配置
1618
1719* 框架默认提供了两种入口
@@ -223,4 +225,55 @@ java.lang.SecurityException: grantRuntimePermission:
223225
224226 * 换一台手机再试
225227
226- * 作者建议如果没有这个需求,则不需要开启此项功能,因为这样会导致 Logcat 显示的日志变多,会增加日志的复杂度和查找的难度
228+ * 作者建议如果没有这个需求,则不需要开启此项功能,因为这样会导致 Logcat 显示的日志变多,会增加日志的复杂度和查找的难度
229+
230+ #### 我如果要在线上使用这个库该怎么办
231+
232+ * 首先我是十分不推荐在线上使用这个库,因为这个库的定位是为了方便调试使用,我也不敢保证这个库在线上使用会有什么问题,当然你如果要一定这样做,也不是没有办法,具体步骤如下:
233+
234+ * 第一步:将依赖方式从 ` debugImplementation ` 修改成 ` implementation `
235+
236+ ``` groovy
237+ dependencies {
238+ debugImplementation 'com.github.getActivity:Logcat:x.x'
239+ }
240+ ```
241+
242+ ``` groovy
243+ dependencies {
244+ implementation 'com.github.getActivity:Logcat:x.x'
245+ }
246+ ```
247+
248+ * 第二步:隐藏 Logcat 入口展示
249+
250+ ``` xml
251+ <manifest >
252+
253+ <application >
254+
255+ <!-- 悬浮窗入口 -->
256+ <meta-data
257+ android : name =" LogcatWindowEntrance"
258+ android : value =" false" />
259+
260+ <!-- 通知栏入口 -->
261+ <meta-data
262+ android : name =" LogcatNotifyEntrance"
263+ android : value =" false" />
264+
265+ </application >
266+
267+ </manifest >
268+ ```
269+
270+ * 第三步:在合适的时机调起 Logcat
271+
272+ ``` java
273+ try {
274+ Class<?> clazz = Class . forName(" com.hjq.logcat.LogcatActivity" );
275+ startActivity(new Intent (this , clazz));
276+ } catch (ClassNotFoundException e) {
277+ e. printStackTrace();
278+ }
279+ ```
Original file line number Diff line number Diff line change @@ -128,6 +128,8 @@ android.enableJetifier = true
128128
129129* 省市区 Json 数据:[ ProvinceJson] ( https://github.com/getActivity/ProvinceJson ) ![ ] ( https://img.shields.io/github/stars/getActivity/ProvinceJson.svg ) ![ ] ( https://img.shields.io/github/forks/getActivity/ProvinceJson.svg )
130130
131+ * Markdown 语法文档:[ MarkdownDoc] ( https://github.com/getActivity/MarkdownDoc ) ![ ] ( https://img.shields.io/github/stars/getActivity/MarkdownDoc.svg ) ![ ] ( https://img.shields.io/github/forks/getActivity/MarkdownDoc.svg )
132+
131133#### 微信公众号:Android轮子哥
132134
133135![ ] ( https://raw.githubusercontent.com/getActivity/Donate/master/picture/official_ccount.png )
You can’t perform that action at this time.
0 commit comments