MiguelSlv
MiguelSlv

Reputation: 15173

Error: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.local.SQLiteSchema

I got the below error when running on a physical android API 24:

  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/base/CharMatcher;
        at com.google.common.base.Splitter.on(Splitter.java:125)
        at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:203)
        at io.grpc.internal.AbstractManagedChannelImplBuilder.<clinit>(AbstractManagedChannelImplBuilder.java:84)
        at io.grpc.okhttp.OkHttpChannelBuilder.forTarget(OkHttpChannelBuilder.java:119)
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:48)
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:27)
        at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:73)
        at com.google.firebase.firestore.remote.GrpcCallProvider.initChannel(com.google.firebase:firebase-firestore@@21.1.1:92)
        at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$new$0(com.google.firebase:firebase-firestore@@21.1.1:62)
        at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.call(com.google.firebase:firebase-firestore@@21.1.1)
        at com.google.android.gms.tasks.zzv.run(Unknown Source)
        at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(com.google.firebase:firebase-firestore@@21.1.1:54)
        at com.google.firebase.firestore.util.ThrottledForwardingExecutor$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.1.1)
        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:818)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.base.CharMatcher" on path: DexPathList[[zip file "/data/app/com.byte_artisan.mchat2-1/base.apk"],nativeLibraryDirectories=[/data/app/com.byte_artisan.mchat2-1/lib/arm, /vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at com.google.common.base.Splitter.on(Splitter.java:125) 
        at io.grpc.internal.GrpcUtil.<clinit>(GrpcUtil.java:203) 
        at io.grpc.internal.AbstractManagedChannelImplBuilder.<clinit>(AbstractManagedChannelImplBuilder.java:84) 
        at io.grpc.okhttp.OkHttpChannelBuilder.forTarget(OkHttpChannelBuilder.java:119) 
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:48) 
        at io.grpc.okhttp.OkHttpChannelProvider.builderForTarget(OkHttpChannelProvider.java:27) 
        at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:73) 
        at com.google.firebase.firestore.remote.GrpcCallProvider.initChannel(com.google.firebase:firebase-firestore@@21.1.1:92) 
        at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$new$0(com.google.firebase:firebase-firestore@@21.1.1:62) 
        at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.call(com.google.firebase:firebase-firestore@@21.1.1) 
        at com.google.android.gms.tasks.zzv.run(Unknown Source) 
        at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(com.google.firebase:firebase-firestore@@21.1.1:54) 
        at com.google.firebase.firestore.util.ThrottledForwardingExecutor$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.1.1) 
        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:818) 
        Suppressed: java.lang.NoClassDefFoundError: com.google.common.base.CharMatcher
        at dalvik.system.DexFile.defineClassNative(Native Method)
        at dalvik.system.DexFile.defineClass(DexFile.java:226)
        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
        at dalvik.system.DexPathList.findClass(DexPathList.java:321)
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                ... 18 more
        Suppressed: java.lang.ClassNotFoundException: com.google.common.base.CharMatcher
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                ... 17 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Observing the stack, the error seems to come from firestore initialization.

The error start to pop after recent updates of firebase libraries, can´t precise with one or witch version. Also the app starts well in recent versions of Android.

Upvotes: 2

Views: 2383

Answers (2)

Maxim M.
Maxim M.

Reputation: 23

I have problem because of conflict guava versions in different libs. So the fix was exclude guava from one library:

 implementation("com.google.protobuf:protobuf-java-util:3.25.0") {
     exclude group: "com.google.guava", module: "guava"
     exclude group: "com.google.guava", module: "guava-jdk5"
 }

Upvotes: 1

MiguelSlv
MiguelSlv

Reputation: 15173

The problem was a conflict with guava library, according to this long post on github.

To fix i needed to change the guava version from '28.0-jre' to '28.0-android', like this:

implementation group: 'com.google.guava', name: 'guava', version: '28.1-android'

Hope can save someone a few hours.

Upvotes: 9

Related Questions