Skip to content

RuntimeException: Internal error in Firestore (20.1.0). #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TomislavMladenov opened this issue Jul 10, 2019 · 42 comments
Closed

RuntimeException: Internal error in Firestore (20.1.0). #596

TomislavMladenov opened this issue Jul 10, 2019 · 42 comments
Assignees

Comments

@TomislavMladenov
Copy link

TomislavMladenov commented Jul 10, 2019

Describe your environment

  • Android Studio version: 3.4.2
  • Firebase Component: FireStore
  • Component version: 20.1.0

Describe the problem

Just started implementing FireStore and while I was trying to get the dummy data from my firestore I got this error. Every time I try to start the app it crashes. If I remove the firestore dependency everything is working fine. So after 2 days trying to solve it searching about it, I simple wasn't able to do so. If you can help in any way will be appreciated

Steps to reproduce:

Start the app.

** Relevant Code:**

Gradle app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"
    defaultConfig {
        applicationId "com.example.sieredelivery"
        minSdkVersion 22
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
}

dependencies {
    //Support libraries
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha07'
    implementation 'com.google.android.material:material:1.0.0'
    //Firebase
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.gms:google-services:4.3.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.google.firebase:firebase-functions:18.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.firebase:firebase-perf:18.0.1'
    implementation 'com.firebase:firebase-client-android:2.3.1'
    implementation 'com.google.firebase:firebase-firestore:20.1.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    //Room
    implementation "androidx.room:room-runtime:2.1.0"
    annotationProcessor "androidx.room:room-compiler:2.1.0"

    //test
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

apply plugin: 'com.google.gms.google-services'

Gradle project

buildscript {
    repositories {
        google()
        jcenter()

        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.2.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

MainActivity (test run on the fireStore)

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        setPresenter();
        setToolbar();
        setBottomNavigation();
        loadFragment(SearchFragment.getInstance());
        createNewStore();


    }

    private void createNewStore() {
        FirebaseFirestore db = FirebaseFirestore.getInstance();

        db.collection("stores")
                .get()
                .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
                    @Override
                    public void onComplete(@NonNull Task<QuerySnapshot> task) {
                        if (task.isSuccessful()) {
                            for (QueryDocumentSnapshot document : task.getResult()) {
                                Log.d(TAG, document.getId() + " => " + document.getData());
                            }
                        } else {
                            Log.w(TAG, "Error getting documents.", task.getException());
                        }
                    }
                });
    }

Error

java.lang.RuntimeException: Internal error in Firestore (20.1.0).
        at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5(com.google.firebase:firebase-firestore@@20.1.0:379)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(com.google.firebase:firebase-firestore@@20.1.0)
        at android.os.Handler.handleCallback(Handler.java:815)
        at android.os.Handler.dispatchMessage(Handler.java:104)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5643)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/local/SQLiteSchema$$Lambda$6;
        at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers(com.google.firebase:firebase-firestore@@20.1.0:364)
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@20.1.0:123)
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@20.1.0:74)
        at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate(com.google.firebase:firebase-firestore@@20.1.0:302)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
        at com.google.firebase.firestore.local.SQLitePersistence.start(com.google.firebase:firebase-firestore@@20.1.0:125)
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@20.1.0:254)
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2(com.google.firebase:firebase-firestore@@20.1.0:117)
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(com.google.firebase:firebase-firestore@@20.1.0)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4(com.google.firebase:firebase-firestore@@20.1.0:311)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(com.google.firebase:firebase-firestore@@20.1.0)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3(com.google.firebase:firebase-firestore@@20.1.0:287)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(com.google.firebase:firebase-firestore@@20.1.0)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@20.1.0:205)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.local.SQLiteSchema$$Lambda$6" on path: DexPathList[[zip file "/data/app/com.example.sieredelivery-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
        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.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers(com.google.firebase:firebase-firestore@@20.1.0:364) 
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@20.1.0:123) 
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@20.1.0:74) 
        at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate(com.google.firebase:firebase-firestore@@20.1.0:302) 
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251) 
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163) 
        at com.google.firebase.firestore.local.SQLitePersistence.start(com.google.firebase:firebase-firestore@@20.1.0:125) 
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@20.1.0:254) 
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2(com.google.firebase:firebase-firestore@@20.1.0:117) 
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(com.google.firebase:firebase-firestore@@20.1.0) 
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4(com.google.firebase:firebase-firestore@@20.1.0:311) 
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(com.google.firebase:firebase-firestore@@20.1.0) 
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3(com.google.firebase:firebase-firestore@@20.1.0:287) 
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(com.google.firebase:firebase-firestore@@20.1.0) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@20.1.0:205) 
        at java.lang.Thread.run(Thread.java:818) 
    	Suppressed: java.lang.NoClassDefFoundError: com.google.firebase.firestore.local.SQLiteSchema$$Lambda$6
        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.DexPat
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@h-amg
Copy link

h-amg commented Jul 10, 2019

@TomislavMladenov I have the exact same problem, here is what i noticed while trying to debug it:

  • It occurs only after retrieving data from firestore while writing data works fine.
  • The data is actually retrieved successfully (it shows up in the log).
  • The app crashes well after data retrieval.

@var-const
Copy link
Contributor

@h-amg Could you please provide some additional information?

  • the exact exception message;
  • debug logs (use FirebaseFirestore.setLoggingEnabled(true) to enable logging; please make sure the logs contain no sensitive information).

It is surprising that you would experience the exception described in the original post while also have logs that show successful data retrieval. The original exception occurs in a part of code that runs before any other Firestore operation can run, so it would appear no data retrieval should be possible.

@var-const
Copy link
Contributor

@TomislavMladenov Thanks for the repro case, I will try it out locally and see if I can reproduce the issue.

@h-amg
Copy link

h-amg commented Jul 11, 2019

@var-const seems like i got it all wrong.

  1. My exception message is different to the one in the post:

Caused by: java.lang.VerifyError: Verifier rejected class com.google.firestore.v1.WriteResponse due to bad method java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object) (declaration of 'com.google.firestore.v1.WriteResponse' appears in /data/app/com.app.android.name-1/split_lib_dependencies_apk.apk:classes2.dex)

  1. Data retrieval was actually unsuccessful, code runs normally anywhere but inside firestore onComplete callback method:

          try{
                userDocRef = db.collection("***s").document("******************sa");
                userDocRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
                    @Override
                    public void onComplete(@NonNull Task<DocumentSnapshot> task) {
                        if (task.isSuccessful()) {
                            DocumentSnapshot document = task.getResult();
                            if (document.exists()) {
                                Log.d(TAG, "DocumentSnapshot data: " + document.getData());
                            } else {
                                Log.d(TAG, "No such document");
                            }
                        } else {
                            Log.d(TAG, "get failed with ", task.getException());
                        }
                    }
                });
            }catch (Exception e){
                Log.d(TAG, "Error retrieving user doc data: " + e);
            }
    

DebugLogs:

07-11 08:02:11.603 27666-27666/com.app.android.name W/DisplayListCanvas: DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
07-11 08:02:11.613 27666-27666/com.app.android.name D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
07-11 08:02:11.653 27666-28056/com.app.android.name I/DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
07-11 08:02:11.653 27666-28056/com.app.android.name W/ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
07-11 08:02:11.653 27666-28056/com.app.android.name W/ResourcesManager: getTopLevelResources: /data/app/com.google.android.gms-1/base.apk / 1.0 running in com.app.android.name rsrc of package null
07-11 08:02:11.683 27666-27666/com.app.android.name I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@ff29e8d time:147037202
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: Verification error in void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp)
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp): [0x10] couldn't find method com.google.protobuf.Timestamp$Builder.mergeFrom (Lcom/google/protobuf/GeneratedMessageLite;)Lcom/google/protobuf/GeneratedMessageLite$Builder;
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp) failed to verify: void com.google.firestore.v1.WriteResponse.mergeCommitTime(com.google.protobuf.Timestamp): [0x10] register v3 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLite
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: Verification error in java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object)
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object): [0x5C] couldn't find method com.google.protobuf.Timestamp.toBuilder ()Lcom/google/protobuf/GeneratedMessageLite$Builder;
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object): [0x73] couldn't find method com.google.protobuf.Timestamp$Builder.mergeFrom (Lcom/google/protobuf/GeneratedMessageLite;)Lcom/google/protobuf/GeneratedMessageLite$Builder;
07-11 08:02:11.723 27666-29453/com.app.android.name I/art: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object) failed to verify: java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object): [0x73] register v5 has type Precise Reference: com.google.protobuf.Timestamp but expected Reference: com.google.protobuf.GeneratedMessageLite
07-11 08:02:11.723 27666-29453/com.app.android.name W/art: Verification failed on class com.google.firestore.v1.WriteResponse in /data/app/com.app.android.name-1/split_lib_dependencies_apk.apk because: Verifier rejected class com.google.firestore.v1.WriteResponse due to bad method java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object)
07-11 08:02:11.733 27666-27666/com.app.android.name D/AndroidRuntime: Shutting down VM
07-11 08:02:11.733 27666-27666/com.app.android.name E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.android.name, PID: 27666
java.lang.RuntimeException: Internal error in Firestore (20.1.0).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5(com.google.firebase:firebase-firestore@@20.1.0:379)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(com.google.firebase:firebase-firestore@@20.1.0)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.VerifyError: Verifier rejected class com.google.firestore.v1.WriteResponse due to bad method java.lang.Object com.google.firestore.v1.WriteResponse.dynamicMethod(com.google.protobuf.GeneratedMessageLite$MethodToInvoke, java.lang.Object, java.lang.Object) (declaration of 'com.google.firestore.v1.WriteResponse' appears in /data/app/com.app.android.name-1/split_lib_dependencies_apk.apk)
at com.google.firestore.v1.WriteResponse.getDefaultInstance(com.google.firebase:firebase-firestore@@20.1.0:1012)
at com.google.firestore.v1.FirestoreGrpc.getWriteMethod(com.google.firebase:firebase-firestore@@20.1.0:379)
at com.google.firebase.firestore.remote.WriteStream.(com.google.firebase:firebase-firestore@@20.1.0:74)
at com.google.firebase.firestore.remote.Datastore.createWriteStream(com.google.firebase:firebase-firestore@@20.1.0:104)
at com.google.firebase.firestore.remote.RemoteStore.(com.google.firebase:firebase-firestore@@20.1.0:186)
at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@20.1.0:263)
at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2(com.google.firebase:firebase-firestore@@20.1.0:117)
at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(com.google.firebase:firebase-firestore@@20.1.0)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4(com.google.firebase:firebase-firestore@@20.1.0:311)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(com.google.firebase:firebase-firestore@@20.1.0)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3(com.google.firebase:firebase-firestore@@20.1.0:287)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(com.google.firebase:firebase-firestore@@20.1.0)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@20.1.0:205)
at java.lang.Thread.run(Thread.java:818)
07-11 08:02:11.863 27666-27685/com.app.android.name W/art: Suspending all threads took: 62.326ms
07-11 08:02:11.893 27666-27685/com.app.android.name I/art: Background sticky concurrent mark sweep GC freed 78605(5MB) AllocSpace objects, 48(2MB) LOS objects, 18% free, 28MB/35MB, paused 63.394ms total 143.944ms
07-11 08:02:11.963 27666-28056/com.app.android.name V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 284 native methods...
07-11 08:02:12.073 27666-28056/com.app.android.name I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
07-11 08:02:12.083 27666-28056/com.app.android.name I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
07-11 08:02:12.083 27666-28056/com.app.android.name I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
07-11 08:02:12.083 27666-28056/com.app.android.name I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
07-11 08:02:12.133 27666-28056/com.app.android.name I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL

Note:
I had duplicate classes issue between firebase and dialogflow earlier and i excluded them using the following in build.gradle file:

   android {
   
       ...
   
       configurations {
           implementation.exclude module: 'protolite-well-known-types'
           implementation.exclude module: 'protobuf-lite' 
       }
   }

@TomislavMladenov
Copy link
Author

@var-const I can send you the source code or upload it to github if neeeded, to see if it will help reproduce it. I just started the app so there's basically there is nothing just basic things.

@var-const
Copy link
Contributor

@TomislavMladenov It would be super-helpful! You can upload it to Github or send it to my email, varconst at google.com. Please make sure there's no sensitive data before sharing.

@var-const
Copy link
Contributor

@h-amg It looks like a different issue. I will take a look; in the meantime, can you please open a new issue in this repo and just copy all the info you provided there?

@var-const
Copy link
Contributor

@TomislavMladenov Update: I couldn't reproduce the issue. I created a new app from scratch and used the code/Gradle snippets you provided. I had to add a tiny bit of logic to add a document to the collection, but after that, the document is read successfully. So I would need a repro case to continue with the issue.

@pranaytokopedia
Copy link

pranaytokopedia commented Jul 18, 2019

i am also facing the same issue. i dont have any duplicate classes and no build time conflicts

@wilhuff
Copy link
Contributor

wilhuff commented Jul 19, 2019

At this point, where we are with this issue is that we're not clear on what could be causing the problem but can't reproduce it so we have no way to investigate. If you're also facing this issue, then the best way to help us track it down is to help us reproduce the problem, as @var-const requested above.

There are a few ways you can do this:

  • Package up your project and share it with us
  • Put together detailed instructions for how we can recreate the issue

As it stands there's not a whole lot we can do to help.

@pranaytokopedia
Copy link

pranaytokopedia commented Jul 22, 2019

from what i have investigated, this seems to be only reproduced in android 5.x and 6.x devices. so it maybe because these android versions dont support java lamdas oe something like that. i am using firestore version 17.1.2 and im getting the same error , just that the name of the generated lamda class is different. at first i thought maybe it was proguard error due to obfuscation. but even after removing proguard, the error persists
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/local/SQLiteSchema$$Lambda$2;
fyi the code works fine with android 7.0 and above

@BlueRayNL
Copy link

No , I am having the same issue on android Q version 9+

@google-oss-bot
Copy link
Contributor

Hey @TomislavMladenov. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@TomislavMladenov if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@rylexr
Copy link

rylexr commented Aug 4, 2019

Some users of my app are facing same issue. Here's the data I got:

Fatal Exception: java.lang.RuntimeException: Internal error in Firestore (20.2.0).
       at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5 + 379(AsyncQueue.java:379)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(AsyncQueue.java)
       at android.os.Handler.handleCallback + 815(Handler.java:815)
       at android.os.Handler.dispatchMessage + 104(Handler.java:104)
       at android.os.Looper.loop + 207(Looper.java:207)
       at android.app.ActivityThread.main + 5728(ActivityThread.java:5728)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 789(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main + 679(ZygoteInit.java:679)
Caused by java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/L/Ga;
       at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers + 364(SQLiteSchema.java:364)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 123(SQLiteSchema.java:123)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 74(SQLiteSchema.java:74)
       at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate + 302(SQLitePersistence.java:302)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked + 251(SQLiteOpenHelper.java:251)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase + 163(SQLiteOpenHelper.java:163)
       at com.google.firebase.firestore.local.SQLitePersistence.start + 125(SQLitePersistence.java:125)
       at com.google.firebase.firestore.core.FirestoreClient.initialize + 254(FirestoreClient.java:254)
       at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2 + 117(FirestoreClient.java:117)
       at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(FirestoreClient.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4 + 311(AsyncQueue.java:311)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(AsyncQueue.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3 + 287(AsyncQueue.java:287)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java)
       at java.util.concurrent.Executors$RunnableAdapter.call + 423(Executors.java:423)
       at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run + 269(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1113(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 588(ThreadPoolExecutor.java:588)
       at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run + 205(AsyncQueue.java:205)
       at java.lang.Thread.run + 818(Thread.java:818)
Caused by java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.L.Ga" on path: DexPathList[[zip file "/data/app/[APP ID REMOVED]-1/base.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.armeabi_v7a.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.en.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.xhdpi.apk"],nativeLibraryDirectories=[/data/app/[APP ID REMOVED]-1/lib/arm, /data/app/[APP ID REMOVED]-1/base.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.armeabi_v7a.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.en.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.xhdpi.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass + 56(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass + 511(ClassLoader.java:511)
       at java.lang.ClassLoader.loadClass + 469(ClassLoader.java:469)
       at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers + 364(SQLiteSchema.java:364)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 123(SQLiteSchema.java:123)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 74(SQLiteSchema.java:74)
       at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate + 302(SQLitePersistence.java:302)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked + 251(SQLiteOpenHelper.java:251)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase + 163(SQLiteOpenHelper.java:163)
       at com.google.firebase.firestore.local.SQLitePersistence.start + 125(SQLitePersistence.java:125)
       at com.google.firebase.firestore.core.FirestoreClient.initialize + 254(FirestoreClient.java:254)
       at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2 + 117(FirestoreClient.java:117)
       at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(FirestoreClient.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4 + 311(AsyncQueue.java:311)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(AsyncQueue.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3 + 287(AsyncQueue.java:287)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java)
       at java.util.concurrent.Executors$RunnableAdapter.call + 423(Executors.java:423)
       at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run + 269(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1113(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 588(ThreadPoolExecutor.java:588)
       at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run + 205(AsyncQueue.java:205)
       at java.lang.Thread.run + 818(Thread.java:818)

Devices showing this issue
Brand: samsung
Model: Galaxy A5(2017)
OS: Version: 6.0.1

Brand: LENOVO
Model: VIBE K10
OS: Version: 6.0

Brand: Sony
Model: Xperia X
OS: Version: 6.0.1

Brand: samsung
Model: Galaxy Note3
OS: Version: 5.0

Brand: Meizu
Model: m3 note
OS: Version: 5.1

Brand: samsung
Model: Galaxy On7 Pro
OS: Version: 6.0.1

Brand: LENOVO
Model: K3 Note
OS: Version: 6.0

None of these devices are rooted. Is there a way you can reopen this issue? Currently, this is # 1 issue on my Crashlytics report and it's affecting a lot of users. I'll be happy to provide more details if you need.

Regards!

@schmidt-sebastian
Copy link
Contributor

@rylexr - Is there a chance you are pulling in two different version of the Firestore SDK? Early releases of our SDK were proguarded, which causes long class names to be rewritten to much shorter names. It looks like part of your stacktrace is Proguarded ("com/google/firebase/firestore/L/Ga"), but other places are not ("com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers").

Can you verify the dependency resolution of your build?

@rylexr
Copy link

rylexr commented Aug 6, 2019

I have a multi-module app and Firestore SDK was included (same version) in both modules. I've refactored code to include Firestore SDK just in one module. I'll report back if issue persist.

@rylexr
Copy link

rylexr commented Aug 7, 2019

Unfortunately, issue still persist. Here's stacktrace:

Fatal Exception: java.lang.RuntimeException: Internal error in Firestore (20.2.0).
       at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5 + 379(AsyncQueue.java:379)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(AsyncQueue.java)
       at android.os.Handler.handleCallback + 815(Handler.java:815)
       at android.os.Handler.dispatchMessage + 104(Handler.java:104)
       at android.os.Looper.loop + 207(Looper.java:207)
       at android.app.ActivityThread.main + 5728(ActivityThread.java:5728)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 789(ZygoteInit.java:789)
       at com.android.internal.os.ZygoteInit.main + 679(ZygoteInit.java:679)
Caused by java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/L/Ga;
       at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers + 364(SQLiteSchema.java:364)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 123(SQLiteSchema.java:123)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 74(SQLiteSchema.java:74)
       at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate + 302(SQLitePersistence.java:302)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked + 251(SQLiteOpenHelper.java:251)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase + 163(SQLiteOpenHelper.java:163)
       at com.google.firebase.firestore.local.SQLitePersistence.start + 125(SQLitePersistence.java:125)
       at com.google.firebase.firestore.core.FirestoreClient.initialize + 254(FirestoreClient.java:254)
       at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2 + 117(FirestoreClient.java:117)
       at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(FirestoreClient.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4 + 311(AsyncQueue.java:311)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(AsyncQueue.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3 + 287(AsyncQueue.java:287)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java)
       at java.util.concurrent.Executors$RunnableAdapter.call + 423(Executors.java:423)
       at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run + 269(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1113(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 588(ThreadPoolExecutor.java:588)
       at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run + 205(AsyncQueue.java:205)
       at java.lang.Thread.run + 818(Thread.java:818)
Caused by java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.L.Ga" on path: DexPathList[[zip file "/data/app/[APP ID REMOVED]-1/base.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.armeabi_v7a.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.en.apk", zip file "/data/app/[APP ID REMOVED]-1/split_config.xhdpi.apk"],nativeLibraryDirectories=[/data/app/[APP ID REMOVED]-1/lib/arm, /data/app/[APP ID REMOVED]-1/base.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.armeabi_v7a.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.en.apk!/lib/armeabi-v7a, /data/app/[APP ID REMOVED]-1/split_config.xhdpi.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass + 56(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass + 511(ClassLoader.java:511)
       at java.lang.ClassLoader.loadClass + 469(ClassLoader.java:469)
       at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers + 364(SQLiteSchema.java:364)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 123(SQLiteSchema.java:123)
       at com.google.firebase.firestore.local.SQLiteSchema.runMigrations + 74(SQLiteSchema.java:74)
       at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate + 302(SQLitePersistence.java:302)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked + 251(SQLiteOpenHelper.java:251)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase + 163(SQLiteOpenHelper.java:163)
       at com.google.firebase.firestore.local.SQLitePersistence.start + 125(SQLitePersistence.java:125)
       at com.google.firebase.firestore.core.FirestoreClient.initialize + 254(FirestoreClient.java:254)
       at com.google.firebase.firestore.core.FirestoreClient.lambda$new$2 + 117(FirestoreClient.java:117)
       at com.google.firebase.firestore.core.FirestoreClient$$Lambda$2.run(FirestoreClient.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$4 + 311(AsyncQueue.java:311)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$4.call(AsyncQueue.java)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$3 + 287(AsyncQueue.java:287)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java)
       at java.util.concurrent.Executors$RunnableAdapter.call + 423(Executors.java:423)
       at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run + 269(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1113(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 588(ThreadPoolExecutor.java:588)
       at com.google.firebase.firestore.util.AsyncQueue$DelayedStartFactory.run + 205(AsyncQueue.java:205)
       at java.lang.Thread.run + 818(Thread.java:818)

Same devices and OSs (Android 5 and Android 6). Dependency tree shows only one place for Firestore SDK 20.2.0 and Proguard rules don't include it. I appreciate any help because this issue is affecting users of my app and is still # 1 in Crashlytics.

Regards!

@rylexr
Copy link

rylexr commented Aug 7, 2019

Sure. This is how it looks like:

  /**
   * Ensures that each entry in the remote document cache has a corresponding sentinel row. Any
   * entries that lack a sentinel row are given one with the sequence number set to the highest
   * recorded sequence number from the target metadata.
   */
  private void ensureSequenceNumbers() {
    // Get the current highest sequence number
    SQLitePersistence.Query sequenceNumberQuery =
        new SQLitePersistence.Query(
            db, "SELECT highest_listen_sequence_number FROM target_globals LIMIT 1");
    Long boxedSequenceNumber = sequenceNumberQuery.firstValue(c -> c.getLong(0));
    hardAssert(boxedSequenceNumber != null, "Missing highest sequence number");

    long sequenceNumber = boxedSequenceNumber;
    SQLiteStatement tagDocument =
        db.compileStatement(
            "INSERT INTO target_documents (target_id, path, sequence_number) VALUES (0, ?, ?)");

    SQLitePersistence.Query untaggedDocumentsQuery =
        new SQLitePersistence.Query(
                db,
                "SELECT RD.path FROM remote_documents AS RD WHERE NOT EXISTS ("
                    + "SELECT TD.path FROM target_documents AS TD "
                    + "WHERE RD.path = TD.path AND TD.target_id = 0"
                    + ") LIMIT ?")
            .binding(SEQUENCE_NUMBER_BATCH_SIZE);

    boolean[] resultsRemaining = new boolean[1];

    do {
      resultsRemaining[0] = false;

      untaggedDocumentsQuery.forEach(
          row -> {
            resultsRemaining[0] = true;
            tagDocument.clearBindings();
            tagDocument.bindString(1, row.getString(0));
            tagDocument.bindLong(2, sequenceNumber);
            hardAssert(tagDocument.executeInsert() != -1, "Failed to insert a sentinel row");
          });
    } while (resultsRemaining[0]);
  }

I believe you're not seeing version 20.2.0. I checked library directly and code is the same as above. I can't reproduce it at all.

@rylexr
Copy link

rylexr commented Aug 7, 2019

BTW, line 364 (the one from stacktrace) is this:

Long boxedSequenceNumber = sequenceNumberQuery.firstValue(c -> c.getLong(0));

@schmidt-sebastian
Copy link
Contributor

Did you resolve the source dependencies in Android Studio? I am more interested in seeing what the decompiled code looks like (which would not have any comments). From your stacktrace it looks like SQLiteSchema$$Lambda$6.lambdaFactory$() is com/google/firebase/firestore/L/Ga in your project. I don't have an explanation for as to why though.

@rylexr
Copy link

rylexr commented Aug 7, 2019

What do you mean? I fired Gradle dependencies task and checked Firestore SDK if that's what you are asking for. First time it was imported by 2 modules but now just by 1. Feel free to tell me what you require specifically and I'll gladly share it.

@schmidt-sebastian
Copy link
Contributor

I was trying to get to the bottom of the binary dependencies that your app is pulling in. It is however extremely unlikely that your Maven dependencies differ from what we published officially, so it is probably not worth exploring this route any further.

I'll see if I can come up with any other theories, but for now I am unfortunately drawing a blank.

@rylexr
Copy link

rylexr commented Aug 9, 2019

Not sure if this is relevant but I have jetifier enabled on my project:

android.useAndroidX=true
android.enableJetifier=true

I'm telling you this because Firestore SDK is under jetified-firebase-20.2.0 folder in my setup.

@rylexr
Copy link

rylexr commented Aug 16, 2019

Hi. Any news on this issue?

@schmidt-sebastian
Copy link
Contributor

Sorry - I have not been able to reproduce this. Are you able to provide us with a small sample project? Does this also occur if you use our quickstart (https://github.com/firebase/quickstart-android/tree/master/firestore)? Thanks!

@rylexr
Copy link

rylexr commented Aug 26, 2019

I'm not able to reproduce it unfortunately. All I can give you is information mentioned above (OS / devices). I was able to talk to one of the users facing it and he mentioned issue disappeared after doing a factory reset of his phone. Is this helpful?

@google-oss-bot
Copy link
Contributor

Hey @TomislavMladenov. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@TomislavMladenov
Copy link
Author

Hello, I quit trying to figure it out. I just went to other database. Have no idea how can this happen on empty project as was mine. Maybe the problem was in me, don't know

@rylexr
Copy link

rylexr commented Sep 4, 2019

While I appreciate the help from you guys I don't understand this behavior of closing tickets automatically because "there are no new updates". There's a lot of information here provided by different users. Please help us fix it.

I managed to reproduce it on a HTC One M8 with Android 6. I still don't know why is happening but I believe it's related to AAB and Firebase on Android 5/6. If I install my application using Android Studio it works correctly. If however, I install the app through Play Store it fails with same error.

@cameronhenige
Copy link

@rylexr I am having pretty much the exact same issue in my app. https://stackoverflow.com/questions/57790871/how-to-fix-internal-error-in-firestore-crash. I am using AAB as well.

@schmidt-sebastian
Copy link
Contributor

We will not be closing this issue as long as there is activity. We, however, still don't have a lead on what is causing these issues and have not been able to see this locally in our testing. I will see if I can track down someone internally that knows if AAB's packaging could explain this issue.

@cameronhenige
Copy link

cameronhenige commented Sep 4, 2019

Hey @schmidt-sebastian, I created a test app that reproduces this issue. https://github.com/cameronhenige/Reproduce-Crash. I ran the app on a Nexus 4 API 23 emulator to reproduce the crash. Android Studio 3.5. Please let me know if you need any more information from me. :)

@schmidt-sebastian
Copy link
Contributor

@cameronhenige Thanks so much! It reproduces for me as well on the specified device (but not on others). I will try to see what is going on. We should not need more information.

@schmidt-sebastian
Copy link
Contributor

@cameronhenige @rylexr @TomislavMladenov

The minimum set of dependencies that reproduces this issue is:

dependencies {
    implementation 'androidx.appcompat:appcompat:1.0.2' // Needed for sample app
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // Needed for sample app
    implementation 'com.google.firebase:firebase-firestore:21.0.0'
    implementation 'com.google.gms:google-services:X.Y.Z'  
}

You should be able to remove your implementation dependency on com.google.gms:google-services. com.google.gms:google-services should only be used at compile time as a plugin (apply plugin 'com.google.gms.google-services'), which allows it to inject code to configure Firebase from your GoogleService-Info.plist file.

To apply com.google.gms:google-services as a plugin, you only have to add it to your classpath but not as a dependency (as done here: https://github.com/cameronhenige/Reproduce-Crash/blob/master/build.gradle#L18)

Furthermore, https://stackoverflow.com/questions/37360126/getting-exception-java-lang-noclassdeffounderror-com-google-firebase-firebaseop mentions that updating to Play Services Version 30 fixes this issue.

Please do let us know if this helps resolve your issue, in which case we can probably close this. We are sorry for the long time that it took us to find a fix/workaround.

@rylexr
Copy link

rylexr commented Sep 5, 2019

@schmidt-sebastian unfortunately that's the exact same configuration I have and still the problem is there. Here is how my config looks like:

root level build.gradle

buildscript {
    ext {
        fabric = '1.29.0'
        firebase_performance = '1.2.0'
        google_services = '4.3.0'
        gradle_tools = '3.6.0-alpha03'
        kotlin_version = '1.3.50'

        firebaseAnalytics = '17.2.0'
        firebaseAuth = '19.0.0'
        firebaseCrashlytics = '2.10.1'
        firebaseDatabase = '19.0.0'
        firebaseFirestore = '21.0.0'
        firebaseFunctions = '19.0.1'
        firebaseMessaging = '20.0.0'
        firebaseStorage = '19.0.0'
        firebasePerformance = '19.0.0'

        playCore = '1.6.1'
        playServicesAuth = '17.0.0'
        playServicesBase = '17.1.0'
        playServicesLocation = '16.0.0'
    }

    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$gradle_tools"
        classpath "com.google.gms:google-services:$google_services"
        classpath "io.fabric.tools:gradle:$fabric"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // Performance Monitoring plugin
        classpath "com.google.firebase:firebase-plugins:$firebase_performance"
    }
}

app level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

repositories {
...
}
android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 21 // LP
        targetSdkVersion 28 // P
    }
    signingConfigs {
    ...
    }
   ...
}
dependencies {
...
}
apply plugin: 'com.google.gms.google-services'

Any ideas?

@cameronhenige
Copy link

@rylexr Sorry to hear you are still having issues. @schmidt-sebastian Thank you so much! You fixed the issue for me!

@schmidt-sebastian
Copy link
Contributor

@rylexr Can you please share your app level dependencies?

dependencies {
...
}

@rylexr
Copy link

rylexr commented Sep 5, 2019 via email

@schmidt-sebastian
Copy link
Contributor

@rylexr Your crash is because of your dependency on Guava.

Note that if you change your guava version from '28.0-jre' to '28.0-android' this crash goes away.

For anyone else that is experiencing this issue: These NoClassDefFound errors seems to be introduced by pulling in dependencies that somehow conflict with Firestore. The way I debugged this is by disabling dependencies until the crash went away. I am not sure what the root source of these problems is, but it is likely not a problem with the Firestore SDK itself.

For @rylexr the crash manifested as:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.local.SQLiteMutationQueue$$Lambda$5" on path: DexPathList[[zip file "/data/app/com.example.reproducecrash-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.reproducecrash-1/lib/x86, /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)

Note that in the final APK, classes4.dex has the following:

Screen Shot 2019-09-05 at 3 33 54 PM

So the class is in fact included (as you can hopefully see despite my bad cropping).

@firebase firebase locked and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants