java.lang.NoSuchMethodError: No direct method - Conflict during migration: Google Places SDK and Volley

java.lang.NoSuchMethodError: No direct method - Conflict during migration: Google Places SDK and Volley

迁移到新 Places SDK 时,我遇到了这个错误:

java.lang.NoSuchMethodError: No direct method <init>(Ljava/io/InputStream;J)V in class Lcom/android/volley/toolbox/DiskBasedCache$CountingInputStream; or its super classes (declaration of 'com.android.volley.toolbox.DiskBasedCache$CountingInputStream' appears in /data/app/com.xx.xxx-SfwuN0IipN88dVqeHkiSvQ==/base.apk)
    at com.android.volley.toolbox.DiskBasedCache.initialize(DiskBasedCache.java:166)
    at com.android.volley.CacheDispatcher.run(CacheDispatcher.java:84)

我在我的应用程序中使用 volley(作为项目导入)。我认为崩溃是由于版本冲突导致的?

我只需要从 places 库中排除 volley 使其工作。

之前:

dependencies {
 implementation 'com.google.android.libraries.places:places:1.0.0'
}

之后:

implementation ('com.google.android.libraries.places:places:1.0.0' ){
    exclude module: 'volley'
}