Open LikeTheSalad opened 4 months ago
Hi @georgesamirmansour - Please could you confirm if the build that had this issue had minify enabled?
@LikeTheSalad yes it has minify enable
Got it, thank you. I'm taking a look at it now.
After taking a detailed look, I noticed that the missing class (SemconvStability
) seems to be removed as of version 2.0.0
of the OTel Java Instrumentation API. This dependency is provided transitively from OTel Android's OkHttp instrumentation with version 2.3.0-alpha
as part of the Elastic Agent version 0.18.0
.
Based on the above, it seems like your project is using a version of the OTel Java instrumentation library older than 2.0.0
, which is a bit strange because it should get the version 2.3.0-alpha
transitively, unless said library is also added directly into your project with a lower version.
In order to verify why your project might be using an old version of the OTel Java instrumentation library, you can run this command in the root of your project:
./gradlew :app:dependencyInsight --dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-api --configuration debugCompileClasspath
Note that it will only work if your project's name is app
, if not, then you'd have to replace :app
by :your-project-name
right after ./gradlew
.
@LikeTheSalad I am using old version of the OTel Java cause we are using Flutter and native, we are trying to build it on top of native and allow support to flutter throw native code, but we can't use newer version of OTel Java
@LikeTheSalad Also we have used version 0.16.0 and it wasn't giving that error. how it's not worked in version 0.18.0
@LikeTheSalad I am using old version of the OTel Java cause we are using Flutter and native, we are trying to build it on top of native and allow support to flutter throw native code, but we can't use newer version of OTel Java
I see, then it seems like this is the reason for the NoClassDefFoundError error. I'm currently contributing to OTel Android/Java, I'm curious to know why the newest OTel Java versions are causing you issues? Maybe it's something that can be solved without downgrading it.
@LikeTheSalad Also we have used version 0.16.0 and it wasn't giving that error. how it's not worked in version 0.18.0
This is because the Elastic agent version 0.16.0
was using version 1.32.0-alpha
of the OTel Java instrumentation. We keep our dependencies up-to-date to ensure that all the new functionality and security fixes are included in our latest releases.
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractorBuilder.buildNetExtractor(HttpClientAttributesExtractorBuilder.java:134) E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractor.(HttpClientAttributesExtractor.java:100)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesExtractorBuilder.build(HttpClientAttributesExtractorBuilder.java:129)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.okhttp.v3_0.internal.OkHttpInstrumenterFactory.create(OkHttpInstrumenterFactory.java:56)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.lambda$static$2(OkHttp3Singletons.java:35)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.$r8$lambda$u63Q7IRr8X_9Th6yCeJtzlM1cyI(OkHttp3Singletons.java:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons$$ExternalSyntheticLambda0.get(R8$$SyntheticClass:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.CachedSupplier.get(CachedSupplier.java:31)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.lambda$static$5(OkHttp3Singletons.java:83)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.$r8$lambda$FBKUum8dYLg-qIeXrCw3rmWpOr8(OkHttp3Singletons.java:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons$$ExternalSyntheticLambda3.get(R8$$SyntheticClass:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.CachedSupplier.get(CachedSupplier.java:31)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.LazyInterceptor.intercept(LazyInterceptor.java:27)
E/AndroidRuntime( 9291): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.lambda$static$4(OkHttp3Singletons.java:76)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.$r8$lambda$663SEQRE2c1G7-M_pfa4eU-NLQ4(OkHttp3Singletons.java:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons$$ExternalSyntheticLambda2.intercept(R8$$SyntheticClass:0)
E/AndroidRuntime( 9291): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.lambda$static$3(OkHttp3Singletons.java:65)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons.$r8$lambda$gJVQNJFg1SbPjywQG7gDltoRIL0(OkHttp3Singletons.java:0)
E/AndroidRuntime( 9291): at io.opentelemetry.instrumentation.library.okhttp.v3_0.internal.OkHttp3Singletons$$ExternalSyntheticLambda1.intercept(R8$$SyntheticClass:0)
E/AndroidRuntime( 9291): at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
E/AndroidRuntime( 9291): at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
E/AndroidRuntime( 9291): at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
E/AndroidRuntime( 9291): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
E/AndroidRuntime( 9291): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
E/AndroidRuntime( 9291): at java.lang.Thread.run(Thread.java:1012)
E/AndroidRuntime( 9291): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.opentelemetry.instrumentation.api.internal.SemconvStability" on path: DexPathList[[zip file "/data/app/
ytm5u3m8tCcFs9-hsUwAjQ==/app.t2.availo-1LyuzmDaaTFr8EbTXOK-Jg==/base.apk"],nativeLibraryDirectories=[/data/app/ytm5u3m8tCcFs9-hsUwAjQ==/app.t2.availo-1LyuzmDaaTFr8EbTXOK-Jg==/lib/arm64, /data/app/~~ytm5u3m8tCcFs9-hsUwAjQ==/app.t2.availo-1LyuzmDaaTFr8EbTXOK-Jg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] E/AndroidRuntime( 9291): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/AndroidRuntime( 9291): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime( 9291): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)Originally posted by @georgesamirmansour in https://github.com/elastic/apm-agent-android/issues/318#issuecomment-2132121683