firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.25k stars 572 forks source link

NoClassDefFoundError on launching a feature when FirebasePerformance i enabled. #1824

Closed dumbo4d closed 3 years ago

dumbo4d commented 4 years ago

Step 1: Are you in the right place?

I do. Reporting a ClassNotFoundException when FirebasePerformanceInstruement is enabled.

Step 2: Describe your environment

Step 3: Describe the problem

I am getting a NoClassDeffError when it is enabled. Everything works fine when I disable it.

Relevant Code:

E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.testflight.app, PID: 22011

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/neovisionaries/ws/client/D;

    at com.neovisionaries.ws.client.WebSocketFactory.<init>(SourceFile:2)

    at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.e(SourceFile:1)

    at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.onEncodingComplete(SourceFile:3)

    at it.slyce.sdk.internal.BitmapEncodingTask.a(SourceFile:4)

    at it.slyce.sdk.internal.BitmapEncodingTask.onPostExecute(SourceFile:1)

    at android.os.AsyncTask.finish(AsyncTask.java:755)

    at android.os.AsyncTask.access$900(AsyncTask.java:192)

    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)

    at android.os.Handler.dispatchMessage(Handler.java:107)

    at android.os.Looper.loop(Looper.java:237)

    at android.app.ActivityThread.main(ActivityThread.java:7811)

    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

 Caused by: java.lang.ClassNotFoundException: Didn't find class "com.neovisionaries.ws.client.D" on path: DexPathList[[zip file "/data/app/com.ashleyfurniturehomestore.ecomm-X1w1G27mqcSRlwfLujt7mQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/lib/arm64, /data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]

    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

    at com.neovisionaries.ws.client.WebSocketFactory.<init>(SourceFile:2) 

    at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.e(SourceFile:1) 

    at it.slyce.sdk.internal.SlyceWebSocketWorkflowTask.onEncodingComplete(SourceFile:3) 

    at it.slyce.sdk.internal.BitmapEncodingTask.a(SourceFile:4) 

    at it.slyce.sdk.internal.BitmapEncodingTask.onPostExecute(SourceFile:1) 

    at android.os.AsyncTask.finish(AsyncTask.java:755) 

    at android.os.AsyncTask.access$900(AsyncTask.java:192) 

    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772) 

    at android.os.Handler.dispatchMessage(Handler.java:107) 

    at android.os.Looper.loop(Looper.java:237) 

    at android.app.ActivityThread.main(ActivityThread.java:7811) 

    at java.lang.reflect.Method.invoke(Native Method) 

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076) 

I am currently using Mac machine.

Root level build.gragdle

image

App level build.gralde:

dependencies {

    implementation 'com.google.firebase:firebase-analytics-ktx:17.4.4'
    implementation 'com.google.firebase:firebase-crashlytics:17.1.1'
    implementation 'com.google.firebase:firebase-perf:19.0.7'

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(dir: 'libs', include: ['*.aar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'

    implementation 'com.abtasty:flagship-android:1.0.1'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'

    implementation 'com.gimbal.android.v4:gimbal-sdk:4.2.1'
    implementation 'com.gimbal.android.v4:gimbal-slf4j-impl:4.2.1'
    implementation 'com.aurelhubert:ahbottomnavigation:2.2.0'

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'com.google.dagger:dagger:2.27'
    implementation 'com.google.dagger:dagger-android:2.15'
    implementation 'com.google.dagger:dagger-android-support:2.15'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.0'
    implementation 'com.google.firebase:firebase-core:17.4.4'
    implementation 'com.google.firebase:firebase-iid:20.2.3'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    implementation 'de.hdodenhof:circleimageview:2.2.0'

    implementation 'com.squareup.okhttp3:okhttp:4.3.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.3.1'

    implementation 'com.multidots:fingerprint-auth:1.0.1'
    implementation 'org.jsoup:jsoup:1.12.1'

    annotationProcessor 'com.google.dagger:dagger-compiler:2.25.2'
    annotationProcessor 'com.google.dagger:dagger-android-processor:2.16'
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'

    kapt 'com.google.dagger:dagger-compiler:2.25.2'
    compileOnly 'javax.annotation:jsr250-api:1.0'

    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:2.25.0'
    testImplementation 'org.mockito:mockito-inline:2.15.0'
    testImplementation 'androidx.arch.core:core-testing:2.1.0'

    testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    testImplementation('org.jetbrains.spek:spek-api:1.1.5') {
        exclude group: 'org.jetbrains.kotlin'
    }
    testImplementation('org.jetbrains.spek:spek-junit-platform-engine:1.1.5') {
        exclude group: 'org.junit.platform'
        exclude group: 'org.jetbrains.kotlin'
    }

    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
google-oss-bot commented 4 years ago

I found a few problems with this issue:

visumickey commented 4 years ago

Thanks for the report, internally tracked at b/162255465

ramanpreetSinghKhinda commented 3 years ago

Hi dumbo4d@,

From the logs it says:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.neovisionaries.ws.client.D" on path: DexPathList[[zip file "/data/app/com.ashleyfurniturehomestore.ecomm-X1w1G27mqcSRlwfLujt7mQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/lib/arm64, /data/app/com.testflight.app-X1w1G27mqcSRlwfLujt7mQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]

This class is from nv-websocket-client and from the stack trace it looks like being loaded from Slyce Android SDK. I can't see a direct dependency towards this library from your app build.gradle. So not sure how you are using it and hence not able to reproduce the problem at my end.

However, from the error com.neovisionaries.ws.client.D, Notice the class D which means the library has been proguarded so it may have class names like A.class, C.class, D.class and d.class. Not to worry as this is perfectly fine to have. The problem seems to be in perf-plugin while processing these case sensitive files on case insensitive file systems and overwriting the outputs after performing the bytecode instrumentation.

This has been recently fixed (internally tracked in b/120025646) and the fix will ship in the upcoming release. So you can keep an eye on https://firebase.google.com/support/release-notes/android.