@@ -22,22 +22,26 @@ public class UtilsApp extends BaseApplication {
2222 @ Override
2323 public void onCreate () {
2424 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 () {
2534 // 内存泄露检查工具
2635 if (LeakCanary .isInAnalyzerProcess (this )) {
2736 // This process is dedicated to LeakCanary for heap analysis.
2837 // You should not init your app in this process.
2938 return ;
3039 }
3140 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 ();
3741 }
3842
3943 public static void initLog () {
40- LogUtils .Builder builder = new LogUtils .Builder ()
44+ LogUtils .Config config = LogUtils .getConfig ()
4145 .setLogSwitch (BuildConfig .DEBUG )// 设置log总开关,包括输出到控制台和文件,默认开
4246 .setConsoleSwitch (BuildConfig .DEBUG )// 设置是否输出到控制台开关,默认开
4347 .setGlobalTag (null )// 设置log全局标签,默认为空
@@ -49,17 +53,17 @@ public static void initLog() {
4953 .setBorderSwitch (true )// 输出日志是否带边框开关,默认开
5054 .setConsoleFilter (LogUtils .V )// log的控制台过滤器,和logcat过滤器同理,默认Verbose
5155 .setFileFilter (LogUtils .V );// log文件过滤器,和logcat过滤器同理,默认Verbose
52- LogUtils .d (builder .toString ());
56+ LogUtils .d (config .toString ());
5357 }
5458
5559 private void initCrash () {
5660 CrashUtils .init ();
5761 }
5862
5963 private void initAssets () {
60- if (!FileUtils .isFileExists (Config .getTestApkPath ())) {
64+ if (!FileUtils .isFileExists (com . blankj . androidutilcode . Config .getTestApkPath ())) {
6165 try {
62- FileIOUtils .writeFileFromIS (Config .getTestApkPath (), getAssets ().open ("test_install" ), false );
66+ FileIOUtils .writeFileFromIS (com . blankj . androidutilcode . Config .getTestApkPath (), getAssets ().open ("test_install" ), false );
6367 } catch (IOException e ) {
6468 e .printStackTrace ();
6569 }
0 commit comments