17 Oct 2024 01:36 PM - last edited on 18 Oct 2024 08:11 AM by MaciejNeumann
I am trying to add dynatrace gradle plugin in my application, when I am adding plugin by following the documentation and adding it to top level gradle, getting this issue
it is too late to add actions as the callbacks already executed. did you try to call beforevariants or onvariants from the old variant api 'applicationvariants' for instance ? you should always call before variants or variants directly from the android components dsl block.
and when using it in app level gradle its not working, also tried turning off dynatrace.ignoreBuildwarning
I am using groovy gradle and its an old project. please suggest something if someone has tried this already
Solved! Go to Solution.
17 Oct 2024 02:03 PM
Hello @devggaurav
DT Resources:
If The mobile app servers are monitored by Oneagent use the third option
For the ENV AG
KR,
Peter
17 Oct 2024 02:15 PM
I tried same applicationId and beaconUrl with a dummy app first, can it be a case that same applicationID and beaconUrl can not be used for two apps ?
17 Oct 2024 02:26 PM
Hello @devggaurav
For the RUM either mobile / web / custom to work perfectly:
It's better to start a fresh instrumentation in collaborative manner including NW and FW team allowing the attached https://docs.dynatrace.com/docs/platform-modules/digital-experience/web-applications/initial-setup/f...
and DT admin creates deletes all this old mobile app related configurations and create a new app, ask for the new configurations from the instrumentation wizard it will contain the application ID and beacon endpoint definitely.
Start an new instrumentation journey and keep the good work up 👨💻😉😊
KR,
Peter
17 Oct 2024 03:25 PM
Can you suggest oneAgent SDK documentation for mobile application ? will that have some banefits ? which one is more convenient way to use ?
17 Oct 2024 04:21 PM - edited 17 Oct 2024 04:21 PM
Hello @devggaurav
It depends on the mobile development framework you will instrument Android 😊or iOS 🤗or what exactly to provide the proper resources.
As simple as that:
Tip:
Hoping this add value.
BR,
Peter
18 Oct 2024 09:48 AM
Theoretically, the applicationId and beaconUrl can be used for multiple applications, because there is no limitation by Dynatrace. But this approach should be avoided.
Dynatrace recommends to use a different applicationId for every mobile application, because the dashboards will give you a proper overview of the application health state based on all reported data.
Some customers prefer to combine their iOS and Android apps into one mobile application and then use the OS filtering option to get the platform-specific metrics. This is the only scenario, where the usage of the same applicationId value is fine.
18 Oct 2024 09:59 AM
I successfully added oneAgent SDK in my android application, with different applicationID and beacon URL, and enabled all, but I am not able to trace web requests from app automatically on dashboard, I want to track all of them , not using any third party web request, all are http, is there some config I am missing
.withUserOptIn(true)
.withCrashReporting(true)
.withActivityMonitoring(true)
.withDebugLogging(true)
.withStartupLoadBalancing(true)
.withHybridMonitoring(true)
18 Oct 2024 10:24 AM
Hello @devggaurav
Good to hear that.
Kindly follow the attached procedure to configure the web request tracing : web-request-monitoring
BR,
Peter
18 Oct 2024 10:27 AM
It says by default it monitors all web request, and I have not disabled it, I am using oneAgent SDK, So do I need to perform something else to make web request monitoring
18 Oct 2024 10:38 AM
You have to use the Dynatrace Android Gradle plugin because it adds the auto-instrumentation step to the Android app build.
When you are using the standalone manual instrumentation option, you have to instrument all web requests manually.
18 Oct 2024 10:46 AM
So when we use OneAgent SDK on android, the web request will not be monitored automatically, it can only be supported by Android Gradle plugin ?
18 Oct 2024 11:00 AM
Yes. If you want auto-instrumentation, you have to use the Dynatrace Android Gradle plugin.
22 Oct 2024 09:17 AM
We can achieve tracking all api's using one agent sdk as well by creating an interceptor
class DynatraceInterceptor: Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val uniqueRequestTag = Dynatrace.getRequestTag()
val timing = Dynatrace.getWebRequestTiming(uniqueRequestTag)
val newRequest = request.newBuilder()
.addHeader(Dynatrace.getRequestTagHeader(), uniqueRequestTag)
.build()
timing.startWebRequestTiming()
return try {
val response = chain.proceed(newRequest)
timing.stopWebRequestTiming(request.url.toUrl(), response.code, response.message)
response
} catch (e: Exception) {
timing.stopWebRequestTiming(request.url.toUrl(), -1, e.toString())
e.printStackTrace()
throw e
}
}
}
and this inteceptor at your httpClient for android mostly its retrofit
val client = OkHttpClient.Builder()
.addInterceptor(DynatraceInterceptor())
.build()
and you can now track all api request without changes and using one agent SDK
18 Oct 2024 10:33 AM
The mentioned error message is generated by the Android Gradle plugin, when another plugin or the user tries to use its API after the step is executed. The Dynatrace Android Gradle plugin is using the API from the Android Gradle plugin to include the auto-instrumentation step into the Android app build process. It is using the android components feature to interact with the Android Gradle plugin and interacts with it before any action is executed.
It seems there is an incompatibility with your build, because you or a plugin is changing the order in which the project setup is executed. Without any build files, we can't further troubleshoot your problem. You can create a support ticket and upload your build.gradle files. Then somebody from the support team will assist you in the troubleshooting effort.
For example, the usage of the Gradle API evaluationDependsOn will change the execution order significantly and therefore the instruction in your Gradle files must be called in the correct order to have a successful build.
You wrote in another message that you tried it with a dummy project. The mentioned API is normally not used in dummy projects. Did you instrument a Flutter or ReactNative app? For these apps, Dynatrace provides the Dynatrace Flutter plugin and the Dynatrace ReactNative plugin.