@@ -22,22 +22,26 @@ public class UtilsApp extends BaseApplication {
22
22
@ Override
23
23
public void onCreate () {
24
24
super .onCreate ();
25
+ com .blankj .utilcode .util .Utils .init (this );
26
+ com .blankj .subutil .util .Utils .init (this );
27
+ initLeakCanary ();
28
+ initLog ();
29
+ initCrash ();
30
+ initAssets ();
31
+ }
32
+
33
+ private void initLeakCanary () {
25
34
// 内存泄露检查工具
26
35
if (LeakCanary .isInAnalyzerProcess (this )) {
27
36
// This process is dedicated to LeakCanary for heap analysis.
28
37
// You should not init your app in this process.
29
38
return ;
30
39
}
31
40
LeakCanary .install (this );
32
- com .blankj .utilcode .util .Utils .init (this );
33
- com .blankj .subutil .util .Utils .init (this );
34
- initLog ();
35
- initCrash ();
36
- initAssets ();
37
41
}
38
42
39
43
public static void initLog () {
40
- LogUtils .Builder builder = new LogUtils .Builder ()
44
+ LogUtils .Config config = LogUtils .getConfig ()
41
45
.setLogSwitch (BuildConfig .DEBUG )// 设置log总开关,包括输出到控制台和文件,默认开
42
46
.setConsoleSwitch (BuildConfig .DEBUG )// 设置是否输出到控制台开关,默认开
43
47
.setGlobalTag (null )// 设置log全局标签,默认为空
@@ -49,17 +53,17 @@ public static void initLog() {
49
53
.setBorderSwitch (true )// 输出日志是否带边框开关,默认开
50
54
.setConsoleFilter (LogUtils .V )// log的控制台过滤器,和logcat过滤器同理,默认Verbose
51
55
.setFileFilter (LogUtils .V );// log文件过滤器,和logcat过滤器同理,默认Verbose
52
- LogUtils .d (builder .toString ());
56
+ LogUtils .d (config .toString ());
53
57
}
54
58
55
59
private void initCrash () {
56
60
CrashUtils .init ();
57
61
}
58
62
59
63
private void initAssets () {
60
- if (!FileUtils .isFileExists (Config .getTestApkPath ())) {
64
+ if (!FileUtils .isFileExists (com . blankj . androidutilcode . Config .getTestApkPath ())) {
61
65
try {
62
- FileIOUtils .writeFileFromIS (Config .getTestApkPath (), getAssets ().open ("test_install" ), false );
66
+ FileIOUtils .writeFileFromIS (com . blankj . androidutilcode . Config .getTestApkPath (), getAssets ().open ("test_install" ), false );
63
67
} catch (IOException e ) {
64
68
e .printStackTrace ();
65
69
}
0 commit comments