Leakcanary: Run Failed

Created on 8 Apr 2016  路  11Comments  路  Source: square/leakcanary

Warning:Ignoring InnerClasses attribute for an anonymous inner class (com.squareup.haha.guava.base.Joiner$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. Warning:Ignoring InnerClasses attribute for an anonymous inner class (com.squareup.haha.guava.collect.Iterables$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. Warning:Ignoring InnerClasses attribute for an anonymous inner class (com.squareup.haha.guava.collect.Iterables$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class.

gradle :
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
run failed with Android Sutdio ! How to resolve this error?

Most helpful comment

Run into the exactly same issue, @AlexWih add testCompile in my situation is not working :(

All 11 comments

Started happening for me after update to Gradle 2.0

I solved the issue by adding following dependency to my build.gradle:

testCompile "com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2"

Run into the exactly same issue, @AlexWih add testCompile in my situation is not working :(

Using leakcanary-no-op is the same as essentially just disabling Leak Canary.
Src: https://github.com/square/leakcanary/wiki/FAQ#how-many-methods-does-leakcanary-add

Any solution ?, same here. My conf:

gradle version 2.10
com.android.tools.build:gradle:1.5.0
leakcanary 1.4-beta2
retrolambda 3.2.3

If i use 1.4-SNAPSHOT, no warning

I guess the "solution" is to either use the SNAPSHOT or wait for a future release that contains the fix. (Note, 1.4-beta2 does NOT appear to contain the fix)

On a related note, 1.4-beta2 is 3 months old. Are we likely to see a new release soon? (even if just another beta)

If you want to use the snapshot, you also need to specify the maven repo:
https://github.com/square/leakcanary/wiki/FAQ#how-do-i-use-the-snapshot-version

  repositories {
    mavenCentral()
    maven {
      url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
  }

As @CDRussell points out, 1.4-SNAPSHOT contains the fix for this issue. We're looking to push another release 'soon'. In the meantime, you can also explicitly include the HAHA dependency, like so:

debugCompile com.squareup.haha:haha:2.0.3
debugCompile com.squareup.leakcanary:leakcanary-android:1.4-beta2

Thanks @jrodbx, explicitly listing HAHA dependency seems like a good intermediate compromise.

Will there be a new beta or final release soon which fixes this issue?

There is now :)

Was this page helpful?
0 / 5 - 0 ratings