sentry-android-gradle-plugin icon indicating copy to clipboard operation
sentry-android-gradle-plugin copied to clipboard

Build Failed: Error while instrumenting Hv.rMN

Open marcospaapen opened this issue 1 year ago • 2 comments

Gradle Version

8.2

AGP Version

8.2.1

Code Minifier/Optimizer

None

Version

4.2.0

Sentry SDK Version

7.2.0

Steps to Reproduce

  • Add com.applovin.mediation:bytedance-adapter:6.2.0.7.0 or any 6.x.x.x.x version to the project. This is part of the applovin max sdk com.applovin:applovin-sdk:13.0.0 https://github.com/AppLovin/AppLovin-MAX-SDK-Android

  • Build the project

Expected Result

Successful build

Actual Result

Task :app:mergeExtDexDebug FAILED [sentry] Error while instrumenting Hv.rMN (Landroid/content/Context;Ljava/util/zip/ZipInputStream;Ljava/lang/String;)Lcom/bytedance/adsdk/lottie/uw;. Please report this issue at https://github.com/getsentry/sentry-android-gradle-plugin/issues java.lang.ArrayIndexOutOfBoundsException

Execution failed for task ':app:mergeExtDexDebug'. Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform ads-sdk-6.2.0.7.aar (com.pangle.global:ads-sdk:6.2.0.7) to match attributes {artifactType=android-dex, asm-transformed-variant=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}. > Execution failed for AsmClassesTransform: /Users/marcospaapen/Developer/Repositories/game5/platform-android/caches/transforms-3/24000cd771d71b4d2aa8c4946da8af68/transformed/ads-sdk-6.2.0.7-runtime.jar. > Error occurred while instrumenting class com.bytedance.adsdk.lottie.Hv

marcospaapen avatar Sep 30 '24 12:09 marcospaapen

hi @marcospaapen, sorry for the issues caused. The root cause is that you're using a minified library that we're trying to instrument through bytecode manipulation, but it's not possible, as the bytecode is not compliant with the JVM spec. You can exclude this specific library from instrumentation as follows:

tracingInstrumentation { 
  excludes = ['com/bytedance/adsdk/**']
}

We'll add this to the troubleshooting page too.

romtsn avatar Oct 02 '24 13:10 romtsn

Thank you @romtsn we decided to disable auto-instrumentation completely and that fixed the issue.

sentry { tracingInstrumentation { enabled = false } }

marcospaapen avatar Oct 04 '24 10:10 marcospaapen