Skip to content
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

java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.local.SQLiteSchema$$Lambda$7" #1125

Closed
Magz8984 opened this issue Jan 14, 2020 · 2 comments

Comments

@Magz8984
Copy link

Magz8984 commented Jan 14, 2020

Environment

  • Android Studio version: 3.5.3
  • Firebase Component: Firestore
  • Component version: 21.3.1

Problem

On android version 6 and 5 firestore causes up crash due to an internal error. I have tried to replicate the issue on quickstart but it seems to work on quickstart. However, I cannot seem to find the problem in my project for 2 days now. I will really appreciate help.

Steps to reproduce:

  • Get firebase instance id on Main Activity perform a simple collection query
  • Run apk on android version 6 or less

Relevant Code:

App Gradle File

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


android {
    compileSdkVersion 29
    defaultConfig {
        multiDexEnabled true
        applicationId "chessbet.app.com"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            ndkBuild {
                arguments '-j8'
            }
        }
    }
    packagingOptions {
        pickFirst 'META-INF/*'
    }
    buildTypes {
        release {
            minifyEnabled false
        }
        debug {
            minifyEnabled false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    externalNativeBuild {
        ndkBuild {
            path file('src/main/cpp/Android.mk')
        }
    }

    buildTypes.each {
        it.buildConfigField("String", "CLOUD_FUNCTIONS_URL", cloudFunctionsURL)
        it.buildConfigField("String", "ADD_MOB_UNIT_ID", adUnitId)
        it.buildConfigField("String", "ADD_MOB_TEST_UNIT_ID", testAdUnitId)
        it.buildConfigField("String", "AD_MOB_APP_ID", adMobAppId)
    }

    lintOptions {
        abortOnError false
    }
}
dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation "androidx.core:core:1.1.0"
    implementation 'com.google.android.material:material:1.2.0-alpha03'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation "androidx.preference:preference:1.1.0"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "androidx.annotation:annotation:1.1.0"
    implementation 'com.jakewharton:butterknife:10.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-database:19.2.0'
    implementation 'com.google.firebase:firebase-firestore:21.3.1'
    implementation 'com.firebaseui:firebase-ui-firestore:6.1.0'
    implementation 'com.firebaseui:firebase-ui-database:6.1.0'

    implementation 'com.google.firebase:firebase-storage:19.1.0'
    implementation "com.squareup.okhttp3:okhttp:4.2.1"
    testImplementation "com.squareup.okhttp3:mockwebserver:4.2.1"
    implementation 'com.github.QuadFlask:colorpicker:0.0.13' // Color picker
    implementation 'com.github.Magz8984:chess-engine-dev:a7f8df6b34'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation 'com.android.support:cardview-v7:29.0.0'
    implementation 'com.google.guava:guava:27.1-jre'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.github.erehmi:countdowntask:1.0.1' // Count Down Timer
    implementation 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar' // Fab Progress Bar
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation 'com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2' // Range Picker
    implementation "com.andkulikov:transitionseverywhere:1.8.1" // Transition everywhere
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.github.GrenderG:Toasty:1.4.2'
}

task copyToAssets(type: Copy) {
    from('build/intermediates/ndkBuild/release/obj/local') {
        include '*/stockfish'
    }
    into 'src/main/assets'
}
tasks.withType(JavaCompile) {
    t -> t.dependsOn copyToAssets
}

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

Code Causing Crash

Query query = db.collection(AccountAPI.ACCOUNT_COLLECTION).whereEqualTo(OWNER_FIELD, user.getUid());
            query.get().addOnCompleteListener(task -> {
                if(task.isSuccessful()){
                    for (QueryDocumentSnapshot document : Objects.requireNonNull(task.getResult())){
                        accountReference = document.getReference();
                        currentAccount = document.toObject(Account.class);
                        currentAccount.setId(accountReference.getId());
                        accountListener.onAccountReceived(currentAccount);
                        // Overkill we already have a listener on main activity
                        EventBroadcast.get().broadCastAccountUpdate();
                    }
                }
                else {
                    Log.d(TAG, Objects.requireNonNull(Objects.requireNonNull(task.getException()).getMessage()));
                }
            });

Error Trace

    java.lang.RuntimeException: Internal error in Cloud Firestore (21.3.1).
        at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(com.google.firebase:firebase-firestore@@21.3.1:529)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(com.google.firebase:firebase-firestore@@21.3.1)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        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:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/local/SQLiteSchema$$Lambda$7;
        at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers(com.google.firebase:firebase-firestore@@21.3.1:423)
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@21.3.1:127)
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@21.3.1:78)
        at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate(com.google.firebase:firebase-firestore@@21.3.1:306)
        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@@21.3.1:129)
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@21.3.1:269)
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0(com.google.firebase:firebase-firestore@@21.3.1:108)
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.3.1)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(com.google.firebase:firebase-firestore@@21.3.1:431)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call(com.google.firebase:firebase-firestore@@21.3.1)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(com.google.firebase:firebase-firestore@@21.3.1:317)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.run(com.google.firebase:firebase-firestore@@21.3.1)
        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$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.3.1:224)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.firestore.local.SQLiteSchema$$Lambda$7" on path: DexPathList[[zip file "/data/app/chessbet.app.com-2/base.apk"],nativeLibraryDirectories=[/data/app/chessbet.app.com-2/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)
        at com.google.firebase.firestore.local.SQLiteSchema.ensureSequenceNumbers(com.google.firebase:firebase-firestore@@21.3.1:423) 
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@21.3.1:127) 
        at com.google.firebase.firestore.local.SQLiteSchema.runMigrations(com.google.firebase:firebase-firestore@@21.3.1:78) 
        at com.google.firebase.firestore.local.SQLitePersistence$OpenHelper.onCreate(com.google.firebase:firebase-firestore@@21.3.1:306) 
        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@@21.3.1:129) 
        at com.google.firebase.firestore.core.FirestoreClient.initialize(com.google.firebase:firebase-firestore@@21.3.1:269) 
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0(com.google.firebase:firebase-firestore@@21.3.1:108) 
        at com.google.firebase.firestore.core.FirestoreClient$$Lambda$1.run(com.google.firebase:firebase-firestore@@21.3.1) 
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(com.google.firebase:firebase-firestore@@21.3.1:431) 
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call(com.google.firebase:firebase-firestore@@21.3.1) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(com.google.firebase:firebase-firestore@@21.3.1:317) 
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.run(com.google.firebase:firebase-firestore@@21.3.1) 
        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$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.3.1:224) 
        at java.lang.Thread.run(Thread.java:818) 
    	Suppressed: java.lang.NoClassDefFoundError: com.google.firebase.firestore.local.SQLiteSchema$$Lambda$7
        at dalvik.system.DexFile.defineClassNative(Native Method)
 

Help will be greatly appreciated

@Magz8984
Copy link
Author

Magz8984 commented Jan 14, 2020

Definitely a bug but is it on my end or firebase sdk ?

@Magz8984
Copy link
Author

Found out it was third party library I wrote having used guava 28.1-jre . On changing it to 28.0-android it worked.

@firebase firebase locked and limited conversation to collaborators Feb 15, 2020
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

2 participants