17 Jan 2025
11:58 AM
- last edited on
20 Jan 2025
07:00 AM
by
MaciejNeumann
We have integrated a package in our app and android build is failing with the error and wanted to exclude that package from instrumentation in react native app. need help to fix it
20 Jan 2025 07:12 AM
Is the error happening in the Metro Bundler or during the build itself? Can we see more information about the error?
Feature which is excluding classes from instrumentation: https://docs.dynatrace.com/docs/observe/digital-experience/mobile-applications/instrument-android-ap...
You need to copy this configuration into the Android part of dynatrace.config.js.
21 Jan 2025 11:26 AM - edited 21 Jan 2025 11:59 AM
@matthias_hochri its happening during the build and we tried the above mentioned steps but still its throwing error.
21 Jan 2025 05:00 PM
Hey ancy_m,
your Android build failed because an Android Gradle task could not receive all class files. The "Error occurred while instrumenting" error message is from the Android Gradle plugin.
It could be related to Dynatrace, because the Dynatrace ReactNative plugin uses the affected feature from the Android Gradle plugin. But without additional information we can't determine the root cause or verify if it is related to our plugin.
My recommendation would be to open a support ticket. There you can upload the whole error message and the support team will assist you in analyzing the problem. As a next step, we would also need the Gradle debug logs to check if Dynatrace modified the affected class.
22 Jan 2025 03:53 PM
> Task :app:dexBuilderRelease FAILED
Unable to find common super type for com/clarisite/mobile/m/l and java/lang/Object.
Unable to find common super type for com/clarisite/mobile/m/l and com/clarisite/mobile/m/n.
Unable to find common super type for java/lang/String and androidx/fragment/app/FragmentManager.
Unable to find common super type for java/lang/Object and androidx/fragment/app/FragmentManager.
Unable to find common super type for okhttp3/HttpUrl and okhttp3/Request.
Unable to find common super type for okhttp3/HttpUrl and java/lang/Object.
Unable to find common super type for okhttp3/Response and java/lang/Object.
Unable to find common super type for okhttp3/Request and com/clarisite/mobile/g/m.
Unable to find common super type for okhttp3/Request and java/lang/Object.
Unable to find common super type for com/clarisite/mobile/g/q and okhttp3/Response.
Unable to find common super type for okhttp3/ResponseBody and okhttp3/Response.
Unable to find common super type for okhttp3/ResponseBody and java/lang/Object.
Unable to find common super type for okio/BufferedSource and java/lang/Object.
Unable to find common super type for okhttp3/RequestBody and com/clarisite/mobile/g/m.
Unable to find common super type for okhttp3/RequestBody and java/lang/Object.
Unable to find common super type for okio/Buffer and java/lang/Object.
Unable to find common super type for okio/Buffer and okhttp3/RequestBody.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexBuilderRelease'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
> Failed to transform glassbox.jar to match attributes {artifactType=android-asm-instrumented-jars, asm-transformed-variant=release, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for AsmClassesTransform: /Users/vmajoka/.gradle/caches/transforms-3/b1dc10c8926c81cd0f2ea8014eaefb38/transformed/jetified-glassbox.jar.
> Error occurred while instrumenting class com.clarisite.mobile.g.s$a
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD FAILED in 3m 53s
832 actionable tasks: 785 executed, 47 up-to-date
/Users/vmajoka/Documents/NewWork/Mobile-OptumRx/packages/common_mock/shared/common.js:78
throw new Error(message);
^
Error: Failed to build Android app
at Object.endProcess (/Users/vmajoka/Documents/NewWork/Mobile-OptumRx/packages/common_mock/shared/common.js:78:9)
at Object.build (/Users/vmajoka/Documents/NewWork/Mobile-OptumRx/packages/app/util/buildAndroid.js:31:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async startAsyncBuild (/Users/vmajoka/Documents/NewWork/Mobile-OptumRx/packages/app/util/build.js:208:7)
Node.js v18.14.0
error Command failed with exit code 1. @
22 Jan 2025 05:09 PM
Gradle does not print the whole stacktrace. You have to run the command with the --stacktrace option (or -s). To print the debug logs, you have to add the -d option. When you run the following command, the Gradle debug logs will be stored in the file debugLogs.txt
./gradlew assembleRelease -d -s > debugLogs.txt 2>&1
As mentioned in my previous ticket, the official workflow is to create a support ticket and attach this information.