Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Square LeakCanary Cannot find symbol

Here is the screenshot

build.gradle has been configured as per github insturctions.LeakCanary class doesn't seem to be included.

 dependencies {
   debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
   releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
 }

enter image description here

analyzer and watcher packages has just 1 single class file in it.

like image 583
WenChao Avatar asked May 11 '15 00:05

WenChao


3 Answers

Rebuilding the project fixed it for me.

There's a deleted answer (I don't know why) by Kaushik Gopal that gives this solution and points to a Github issue

like image 61
Maragues Avatar answered Nov 01 '22 07:11

Maragues


I am honestly surprised that

 dependencies {
   debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
   releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
 }

did not work for you, because it did for me.

Maybe you want to try it with your buildType instead of the productFlavour:

dependencies {
   someBuildTypeCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
}
like image 7
Vic Torious Avatar answered Nov 01 '22 08:11

Vic Torious


  1. Make sure you add the libraries to your build.gradle

    dependencies {
        debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
        releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
    }
    
  2. add mavenCentral() to your repositories

    buildscript {
        repositories {
            jcenter()
            mavenCentral()
        }
        dependencies {
             classpath 'com.android.tools.build:gradle:1.5.0'
        }
    }
    allprojects {
         repositories {
             jcenter()
             mavenCentral()
         }
    }
    
like image 2
tuder Avatar answered Nov 01 '22 08:11

tuder