billyyoyo пре 7 година
родитељ
комит
fb9a794f7a
2 измењених фајлова са 15 додато и 0 уклоњено
  1. 5 0
      app/build.gradle
  2. 10 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

+ 5 - 0
app/build.gradle

@@ -132,6 +132,11 @@ repositories {
 }
 
 dependencies {
+    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2'
+    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
+    // Optional, if you use support library fragments:
+    debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.2'
+
     //noinspection GradleCompatible
     implementation "com.android.support:cardview-v7:$supportLibVersion"
     implementation "com.android.support:design:$supportLibVersion"

+ 10 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -44,6 +44,8 @@ import com.sheep.jiuyan.samllsheep.service.DownloadService;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+import com.squareup.leakcanary.LeakCanary;
+import com.squareup.leakcanary.RefWatcher;
 import com.tencent.bugly.Bugly;
 import com.tencent.bugly.beta.Beta;
 import com.tencent.smtt.sdk.QbSdk;
@@ -146,6 +148,12 @@ public class SheepApp extends MultiDexApplication {
         }
     }
 
+    private RefWatcher refWatcher;
+
+    public static RefWatcher getRefWatcher() {
+        return mSheepApp.refWatcher;
+    }
+
     @Override
     public void onCreate() {
         super.onCreate();
@@ -157,6 +165,8 @@ public class SheepApp extends MultiDexApplication {
             initUtils();
             detectFileUriExposure();
             ChannelContent.getInstance().initChannelContent(this);
+
+            refWatcher = LeakCanary.install(this);
         }
     }