|
1 | 1 | package com.guiying.androidmodulepattern; |
2 | 2 |
|
3 | 3 | import android.content.Context; |
| 4 | +import android.support.multidex.MultiDex; |
4 | 5 |
|
5 | | -import com.github.mzule.activityrouter.annotation.Modules; |
| 6 | +import com.alibaba.android.arouter.launcher.ARouter; |
6 | 7 | import com.guiying.common.base.BaseApplication; |
| 8 | +import com.guiying.common.utils.Utils; |
7 | 9 |
|
8 | 10 | import org.acra.ACRA; |
9 | 11 | import org.acra.ReportField; |
|
15 | 17 | import org.acra.sender.ReportSenderException; |
16 | 18 |
|
17 | 19 | /** |
18 | | - * <p>这里是整个组件化项目管理各个组件的地方,所有需要使用的组件必须在此声明</p> |
| 20 | + * <p>这里仅需做一些初始化的工作</p> |
19 | 21 | * |
20 | 22 | * @author 张华洋 2017/2/15 20:14 |
21 | 23 | * @version V1.2.0 |
|
36 | 38 | resToastText = R.string.crash_toast_text, |
37 | 39 | resDialogText = R.string.crash_dialog_text, |
38 | 40 | resDialogTitle = R.string.crash_dialog_title) |
39 | | -@Modules({"main", "girls", "news"}) |
40 | 41 | public class MyApplication extends BaseApplication { |
41 | 42 |
|
42 | 43 |
|
43 | 44 | @Override |
44 | 45 | public void onCreate() { |
45 | 46 | super.onCreate(); |
| 47 | + if (Utils.isAppDebug()) { |
| 48 | + //开启InstantRun之后,一定要在ARouter.init之前调用openDebug |
| 49 | + ARouter.openDebug(); |
| 50 | + ARouter.openLog(); |
| 51 | + } |
| 52 | + ARouter.init(this); |
46 | 53 | //崩溃日志记录初始化 |
47 | 54 | ACRA.init(this); |
48 | 55 | ACRA.getErrorReporter().removeAllReportSenders(); |
49 | 56 | ACRA.getErrorReporter().setReportSender(new CrashReportSender()); |
50 | 57 | } |
51 | 58 |
|
52 | | -// @Override |
53 | | -// protected void attachBaseContext(Context base) { |
54 | | -// super.attachBaseContext(base); |
55 | | -// // dex突破65535的限制 |
56 | | -// MultiDex.install(this); |
57 | | -// } |
| 59 | + |
| 60 | + @Override |
| 61 | + protected void attachBaseContext(Context base) { |
| 62 | + super.attachBaseContext(base); |
| 63 | + // dex突破65535的限制 |
| 64 | + MultiDex.install(this); |
| 65 | + } |
58 | 66 |
|
59 | 67 |
|
60 | 68 | /** |
|
0 commit comments