Skip to content

0x02b Apply AndroidGodEye for Release_en

hui.zhao edited this page Nov 24, 2019 · 9 revisions

Apply AndroidGodEye For Release

You may want to use AndroidGodEye to monitor the real user's app performance in the production environment. Generally, you can call the observeModule method to consume datas and report to the server in the callback:

        try {
            GodEye.instance().observeModule(GodEye.ModuleName.HEAP, new Consumer<HeapInfo>() {
                @Override
                public void accept(HeapInfo heapInfo) throws Exception {
                    Log.d("AndroidGodEye",String.valueOf(heapInfo));
                }
            });
        } catch (UninstallException e) {
            e.printStackTrace();
        }

Because some modules have some impact on performance, you need to pay special attention to the following points if you use AndroidGodEye in a production environment:

  1. FPS, Thread and Methodcanary modules will have significant impact on performance in theory. It is not recommended to install them in release. If you need FPS module very much, please pay attention to set intervalmillis config to adjust the output frequency and conduct adequate performance test
  2. In the module configuration of leakdetector (leakmemory), please set debug to false and debugNotification to false, so that it only detect the leak event but not the leaked GC root path and other details
  3. In the module configuration of Sm (block), please set debugNotify to false, and pay attention to set the threshold value to prevent excessive reporting of blocking
  4. If you care about apk size, please don't apply plugin: 'cn.hikyson.methodcanary.plugin' in build.gradle of application module project('com.android.application') because it will insert some code into every method
Clone this wiki locally