Closed humanheima closed 6 years ago
安装leak canary之前先判断一下是否是主进程
你的意思是leak的安装不应该在主进程是吧
GodEye.instance().install(LeakDetector.class, new LeakContextImpl2(this, new PermissionRequest() {
@Override
public Observable
我现在用的是1.7.4的版本 //godeye implementation 'cn.hikyson.godeye:godeye-core:1.7.4' debugImplementation 'cn.hikyson.godeye:godeye-monitor:1.7.4' releaseImplementation 'cn.hikyson.godeye:godeye-monitor-no-op:1.7.4' implementation 'cn.hikyson.godeye:godeye-toolbox:1.7.4'
我应该更新版本吗?
1.7.4也可以的,但是readme没有说明让你在主进程安装,你判断下install的时候是否主进程
2.x的版本sample里有demo
好的,谢谢。
java.lang.RuntimeException:Unable to create application com.saic.cmp.business.CMPApplication: java.lang.IllegalStateException: can not call install leak
2 android.app.ActivityThread.handleBindApplication(ActivityThread.java:5973) 3 ...... 4 Caused by: 5 java.lang.IllegalStateException:can not call install leak 6 cn.hikyson.godeye.core.internal.modules.leakdetector.LeakDetector.install(LeakDetector.java:49) 7 cn.hikyson.godeye.core.internal.modules.leakdetector.LeakDetector.install(LeakDetector.java:24) 8 cn.hikyson.godeye.core.GodEye.install(GodEye.java:47) 9 com.saic.cmp.business.CMPApplication.onCreate(CMPApplication.java:150) 10 android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032) 11 android.app.ActivityThread.handleBindApplication(ActivityThread.java:5970) 12 android.app.ActivityThread.-wrap3(ActivityThread.java) 13 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710) 14 android.os.Handler.dispatchMessage(Handler.java:102) 15 android.os.Looper.loop(Looper.java:154) 16 android.app.ActivityThread.main(ActivityThread.java:6776) 17 java.lang.reflect.Method.invoke(Native Method) 18 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 19 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)