diff --git a/app/build.gradle b/app/build.gradle index f83e339..c4809fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,13 +43,12 @@ dependencies { implementation "cn.hikyson.godeye:godeye-core:${VERSION_NAME}" // // Debug dashboard // debugImplementation "cn.hikyson.godeye:godeye-monitor:${VERSION_NAME}" -// // Release no dashboard -// releaseImplementation "cn.hikyson.godeye:godeye-monitor-no-op:${VERSION_NAME}" implementation "cn.hikyson.godeye:godeye-monitor:${VERSION_NAME}" // Extra module, help to monitor network implementation "cn.hikyson.godeye:godeye-okhttp:${VERSION_NAME}" // Extra module, help to monitor crash/ANR implementation "cn.hikyson.godeye:godeye-xcrash:${VERSION_NAME}" + // Extra module, help to monitor leak memory implementation "cn.hikyson.godeye:godeye-leakcanary:${VERSION_NAME}" } diff --git a/app/src/main/java/cn/hikyson/godeyedemo/MainActivity.java b/app/src/main/java/cn/hikyson/godeyedemo/MainActivity.java index 6f3f943..4cc9b93 100644 --- a/app/src/main/java/cn/hikyson/godeyedemo/MainActivity.java +++ b/app/src/main/java/cn/hikyson/godeyedemo/MainActivity.java @@ -52,7 +52,6 @@ public void run() { @Override protected void onDestroy() { super.onDestroy(); - GodEyeMonitor.shutDown(); } public void request(View view) { diff --git a/app/src/main/java/cn/hikyson/godeyedemo/MyApp.java b/app/src/main/java/cn/hikyson/godeyedemo/MyApp.java index ee23116..1450ccb 100644 --- a/app/src/main/java/cn/hikyson/godeyedemo/MyApp.java +++ b/app/src/main/java/cn/hikyson/godeyedemo/MyApp.java @@ -4,20 +4,17 @@ import android.app.ActivityManager; import android.app.Application; import android.content.Context; +import android.util.Log; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import cn.hikyson.android.godeye.okhttp.GodEyePluginOkNetwork; -import cn.hikyson.godeye.core.GodEye; -import cn.hikyson.godeye.core.GodEyeConfig; -import cn.hikyson.godeye.monitor.GodEyeMonitor; -import cn.hikyson.godeye.monitor.modules.appinfo.AppInfoLabel; +import cn.hikyson.godeye.core.GodEyeHelper; +import cn.hikyson.godeye.core.monitor.AppInfoConext; +import cn.hikyson.godeye.core.monitor.AppInfoLabel; import okhttp3.OkHttpClient; -import static cn.hikyson.godeye.core.utils.ProcessUtils.isMainProcess; - /** * Created by kysonchao on 2018/1/29. */ @@ -27,22 +24,18 @@ public class MyApp extends Application { @Override public void onCreate() { super.onCreate(); - if (isMainProcess(this)) { - GodEye.instance().install(GodEyeConfig.fromAssets("android-godeye-config/install.config")); - GodEyeMonitor.injectAppInfoConext(new GodEyeMonitor.AppInfoConext() { - @Override - public List getAppInfo() { - List appInfoLabels = new ArrayList<>(); - appInfoLabels.add(new AppInfoLabel("ApplicationID", BuildConfig.APPLICATION_ID, null)); - appInfoLabels.add(new AppInfoLabel("VersionName", BuildConfig.VERSION_NAME, "")); - appInfoLabels.add(new AppInfoLabel("VersionCode", String.valueOf(BuildConfig.VERSION_CODE), "")); - appInfoLabels.add(new AppInfoLabel("BuildType", BuildConfig.BUILD_TYPE, "")); - appInfoLabels.add(new AppInfoLabel("AndroidGodEye", "https://github.com/Kyson/AndroidGodEye", "https://github.com/Kyson/AndroidGodEye")); - return appInfoLabels; - } - }); - GodEyeMonitor.work(this); - } + GodEyeHelper.setMonitorAppInfoConext(new AppInfoConext() { + @Override + public List getAppInfo() { + List appInfoLabels = new ArrayList<>(); + appInfoLabels.add(new AppInfoLabel("ApplicationID", BuildConfig.APPLICATION_ID, null)); + appInfoLabels.add(new AppInfoLabel("VersionName", BuildConfig.VERSION_NAME, "")); + appInfoLabels.add(new AppInfoLabel("VersionCode", String.valueOf(BuildConfig.VERSION_CODE), "")); + appInfoLabels.add(new AppInfoLabel("BuildType", BuildConfig.BUILD_TYPE, "")); + appInfoLabels.add(new AppInfoLabel("AndroidGodEye", "https://github.com/Kyson/AndroidGodEye", "https://github.com/Kyson/AndroidGodEye")); + return appInfoLabels; + } + }); sApplicationStartTime = System.currentTimeMillis(); MyIntentService.startActionBaz(this, "", ""); } @@ -66,6 +59,10 @@ private static boolean isMainProcess(Application application) { ActivityManager manager = (ActivityManager) application.getSystemService (Context.ACTIVITY_SERVICE); for (ActivityManager.RunningAppProcessInfo process : manager.getRunningAppProcesses()) { + Log.d("kyson", "process.processName:" + process.processName); + Log.d("kyson", "process.pid:" + process.pid); + Log.d("kyson", "process.uid:" + process.uid); + if (process.pid == pid) { processName = process.processName; } diff --git a/gradle.properties b/gradle.properties index 4716978..5bd517f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,6 @@ org.gradle.jvmargs=-Xmx1536m # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -VERSION_NAME=3.3.1 +VERSION_NAME=3.4.0 METHOD_CANARY_VERSION_NAME=0.15.4 USE_ALIYUN_REPO=false \ No newline at end of file