Leakcanary: ava.lang.NoSuchMethodError: No interface method getBuffer()Lokio/Buffer

Created on 18 Nov 2019  路  10Comments  路  Source: square/leakcanary

Description

java.lang.NoSuchMethodError: No interface method getBuffer()Lokio/Buffer

viber_image_2019-11-18_13-30-09

Version Information

  • LeakCanary version: 2.0-beta-3
  • Android OS version: all
  • Gradle version: 4.10.2

Additional Information

java.lang.NoSuchMethodError: No interface method getBuffer()Lokio/Buffer; in class Lokio/BufferedSource; or its super classes (declaration of 'okio.BufferedSource' appears in /data/app/com.viber.voip-6ojoFjZTeEeqwsTlqLMPvA==/base.apk!classes5.dex)
at shark.Hprof.moveReaderTo(Hprof.kt:43)
at shark.internal.HprofInMemoryIndex$Companion.createReadingHprof(HprofInMemoryIndex.kt:404)
at shark.internal.HprofInMemoryIndex$Companion.createReadingHprof$default(HprofInMemoryIndex.kt:346)
at shark.HprofHeapGraph$Companion.indexHprof(HprofHeapGraph.kt:187)
at shark.HeapAnalyzer.analyze(HeapAnalyzer.kt:100)
at leakcanary.internal.HeapAnalyzerService.onHandleIntentInForeground(HeapAnalyzerService.kt:61) 
at leakcanary.internal.ForegroundService.onHandleIntent(ForegroundService.kt:55)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78)
at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
bug

Most helpful comment

The version of retrofit is 2.2.0. It depends on Okio 1.14.0

+--- com.squareup.retrofit2:retrofit:2.2.0
| | | | | | --- com.squareup.okhttp3:okhttp:3.6.0 -> 3.11.0
| | | | | | --- com.squareup.okio:okio:1.14.0

All 10 comments

@alexander-smityuk Can you check which version of Okio is in your project?

Can you please provide the Okio version? If not I will close the issue until we can repro.

I met the same problem.The version of Okio is 1.14.0

@liunana1993 did you force the okio version to 1.14? LeakCanary depends on 2.2.2

@liunana1993 @alexander-smityuk have you tried removing the configuration that forces the Okio dependency to 1.x?

@liunana1993 @alexander-smityuk have you tried removing the configuration that forces the Okio dependency to 1.x?

I tried.But I got another problem.

UncaughtException detected: android.database.sqlite.SQLiteException: Can't downgrade database from version 19 to 16
at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:369)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:263)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:172)
at leakcanary.internal.activity.db.Db$execute$1.invoke(Db.kt:31)
at leakcanary.internal.activity.db.Db$execute$1.invoke(Db.kt:9)
at leakcanary.internal.activity.db.Io$execute$2.invoke(Io.kt:50)
at leakcanary.internal.activity.db.Io$execute$2.run(Io.kt:10)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:831)

This exception is thrown when the leakcanary database is downgraded, which should only happen if the leakcanary version is changed to a lower version. Did you change the leakcanary version? You should stick to the latest release.

I removed the configuration that forces the Okio dependency to 1.14.0 and updated leakcanary to the latest version. It works.

@liunana1993 Thanks!! Can you tell me a bit more about why there was configuration forcing Okio to 1.14.0? I'm assuming there was a good reason at some point.

The version of retrofit is 2.2.0. It depends on Okio 1.14.0

+--- com.squareup.retrofit2:retrofit:2.2.0
| | | | | | --- com.squareup.okhttp3:okhttp:3.6.0 -> 3.11.0
| | | | | | --- com.squareup.okio:okio:1.14.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matejdro picture matejdro  路  6Comments

divyenduz picture divyenduz  路  6Comments

SUPERCILEX picture SUPERCILEX  路  4Comments

arctouch-carlosottoboni picture arctouch-carlosottoboni  路  4Comments

peter1492 picture peter1492  路  6Comments