Instabug / Instabug-Android

In-app feedback and bug reporting tool for apps.
https://instabug.com/
Other
188 stars 41 forks source link

NoClassDefFoundError: InstabugAPMOkhttpInterceptor doesn't exist. #458

Closed Orbyt closed 5 months ago

Orbyt commented 1 year ago

Steps to Reproduce the Problem

Integrate Instabug APM via https://docs.instabug.com/docs/android-apm-network

Expected Behavior

APM product reports network activity appropriately.

Actual Behavior

Error on first network call:

Caught an Unhandled Exception: java.lang.NoClassDefFoundError
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/instabug/library/apmokhttplogger/InstabugAPMOkhttpInterceptor;
        at okhttp3.OkHttpClient.<init>(Unknown Source:0)
        at okhttp3.OkHttpClient$Builder.build(OkHttpClient.kt:1069)
        at com.launchdarkly.sdk.android.HttpFeatureFlagFetcher.<init>(HttpFeatureFlagFetcher.java:59)
        at com.launchdarkly.sdk.android.HttpFeatureFlagFetcher.newInstance(HttpFeatureFlagFetcher.java:43)
        // ...
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.instabug.library.apmokhttplogger.InstabugAPMOkhttpInterceptor" on path: DexPathList...

Note that LaunchDarkly is simply the first network call that occurs in the application under test.

Instabug integration code

val viewHierarchyState = when (spHelper.getSelectedGRUrl()) {
            Constants.grandroundsUatURL -> Feature.State.ENABLED
            else -> Feature.State.DISABLED
        }
        Instabug.Builder(this, BuildConfig.INSTABUG_APPLICATION_TOKEN)
            .setInvocationEvents(InstabugInvocationEvent.NONE)
            .setConsoleLogState(Feature.State.DISABLED)
            .setViewHierarchyState(viewHierarchyState)
            .build()
        BugReporting.setOptions(Option.EMAIL_FIELD_HIDDEN)
        // Specify which of the feedback, bug, or question options appear in the prompt options
        BugReporting.setReportTypes(BugReporting.ReportType.BUG, BugReporting.ReportType.FEEDBACK)
        setInstabugIHEnvironmentAttribute(spHelper)
        Instabug.setPrimaryColor(ContextCompat.getColor(applicationContext, R.color.primaryAction))
        APM.setEnabled(true)
        when (spHelper.getSelectedGRUrl()) {
            Constants.grandroundsUatURL -> {
                Instabug.setReproStepsState(State.ENABLED)
                Instabug.setSessionProfilerState(Feature.State.ENABLED)
                Instabug.setTrackingUserStepsState(Feature.State.ENABLED)
            }
            else -> {
                // Arguments:initialScreenshot, extraScreenshot, galleryImage & ScreenRecording
                BugReporting.setAttachmentTypesEnabled(false, false, false, false)
                Instabug.setReproStepsState(State.DISABLED)
                Instabug.setSessionProfilerState(Feature.State.DISABLED)
                Instabug.setTrackingUserStepsState(Feature.State.DISABLED)
            }
        }

SDK Version

11.10.0

Android Version

33

Device Model

Pixel 4

MohamedHefny commented 1 year ago

Hi @Orbyt Thank you for reaching out and reporting this, please make sure that you're using the same and latest version of Instabug for all of the dependencies (Now it's V 11.11.0). And if this issue keep happening can you please provide your gradle integration for Instabug and APM?

Bashayer-reda commented 5 months ago

Hello @Orbyt Thank you so much for reaching out. Please confirm that you have reviewed our comment above. I will go ahead and close the issue. However, if you encounter any further issues, please feel free to reopen it at any time