cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android x-dynatrace header missing

MTersigni
Newcomer

Hi,

 

I'm trying to integrate Dynatrace on Android. The library was correctly setup on the previous app version that was built on Xamarin, now we are moving to native code.

 

I'm using the Android Gradle Plugin approach with Kotlin DSL.

First of all I needed to downgrade the build gradle plugin to version 7.1.3 because of Dynatrace incompatibilty problem.

 

The library seems correctly configured. I can see the dtxAgentCommunicationManager logging stuff in the logcat but the problem is that I cannot see the "x-dynatrace" header attached to the HTTP calls.

Do you have any idea on what could be the cause?

 

This is my build.gradle.kts file (Top-level build file):

 

buildscript {
val kotlinVersion = "1.7.0"
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.3") // Dynatrace is not compatible with the newer build gradle plugin versions
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.google.gms:google-services:4.3.10")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.0")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.42")
classpath("com.dynatrace.tools.android:gradle-plugin:8.+")
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}

apply(plugin = "com.dynatrace.instrumentation")
configure<com.dynatrace.tools.android.dsl.DynatraceExtension> {
configurations {
create("store") {
autoStart {
applicationId("[APPLICATION_ID]")
beaconUrl("[BEACON_URL]")
}
userOptIn(true)
agentBehavior {
startupLoadBalancing(false)
debug {
agentLogging(true)
}
}
}
}
}

 

Thanks,

Marco

2 REPLIES 2

techean
Dynatrace Pro
Dynatrace Pro

Hi Marco,

 

This will be due to multiple reason. I recommend get a support ticket raised and get verified the actual root cause. Before raising the ticket check technology compatability with oneagent. Try changing headers to  x-dynaTrace-text instead of x -dynatrace. For downgrading the gradle plugin try using strict-versions or you can force a dependency 

KG

Thomas_Wirth1
Dynatrace Champion
Dynatrace Champion

Hey MTersigni,

 

Incompatibility problem:
There is a regression in Android Gradle plugin 7.2.0 that affects your project. Therefore Dynatrace has canceled the build to avoid runtime crashes. We have already reported the problem to Google and they will release the fix with version 7.2.2 of the Android Gradle plugin (see https://issuetracker.google.com/issues/232438924#comment3 ). Unfortunately the only other workaround is to upgrade to Android Gradle plugin 7.3 beta.

 

"x-dynatrace" header:
Your build file looks fine. You can check the following two points:

* What http library are you using? Here is a list of supported http frameworks

* Did you add the method call Dynatrace#applyUserPrivacyOptions to adjust the data collection level. When the property userOptIn is used, OneAgent initially starts with level "OFF" until it is changed (by the user). Fore more information see the documentation

If the problem still exists, then we recommend to create a support ticket and provide the agent debug logs.