# Mobile applications: Issues with Dynatrace Xamarin NuGet package

**URL:** <https://community.dynatrace.com/t/mobile-applications-issues-with-dynatrace-xamarin-nuget-package/43250>\
**Category:** Troubleshooting\
**Tags:** real-user-monitoring-classic, mobile-monitoring\
**Created:** [January 2, 2024, 10:00am UTC](https://community.dynatrace.com/t/mobile-applications-issues-with-dynatrace-xamarin-nuget-package/43250 "2024-01-02T10:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maliborskaya](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@maliborskaya](https://community.dynatrace.com/u/maliborskaya)\
**Post date:** [January 2, 2024, 10:00am UTC](https://community.dynatrace.com/t/mobile-applications-issues-with-dynatrace-xamarin-nuget-package/43250/1 "2024-01-02T10:00:00Z")

</div>

If you can’t resolve a problem with the [Dynatrace Xamarin NuGet package](https://docs.dynatrace.com/docs/shortlink/xamarin) for your mobile applications, please contact a Dynatrace product expert via live chat within your Dynatrace environment. Have the following details available:

- [OneAgent debug logs](https://docs.dynatrace.com/docs/shortlink/xamarin#agent-debug-logs)
- Your&nbsp;`dynatrace.config.json`&nbsp;file

## Failed build

If your build fails, make sure you’ve added the&nbsp;`dynatrace.config.json`&nbsp;file to the&nbsp;`Assets`&nbsp;(Android) or&nbsp;`Resources`&nbsp;(iOS) directory and that the file includes at least the beacon URL and the application ID properties. For details, see&nbsp;[Configuration file](https://docs.dynatrace.com/docs/shortlink/xamarin#config-file).

If you use the&nbsp;[manual startup](https://docs.dynatrace.com/docs/shortlink/xamarin#start-agent), don’t include the beacon URL and the application ID properties in the configuration file. If you do that, you encounter an exception.

## Dynatrace.Xamarin.Build.Android and iOS

The following error might occur in older Xamarin Android or iOS projects.

**Android**

```markup
Target DynatraceAndroidBuildVerify:
    dotnet "/tools/netcoreapp3.1/Dynatrace.Xamarin.Build.Android.dll" verify config="obj/Debug/assets/dynatrace.config.json" java="/Users/<user>/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25/bin" dynatraceJar="/tools/java/instrumentor-cli-8.223.1.1003.jar"
    Could not execute because the specified command or file was not found.

```

**iOS**

```markup
dotnet "/tools/netcoreapp3.1/Dynatrace.Xamarin.Build.iOS.dll" "Debug"

Could not execute because the specified command or file was not found.

```

The Dynatrace Xamarin package&nbsp;`MSBuild`&nbsp;command can’t resolve the package directory because the&nbsp;`.csproj`&nbsp;file references Dynatrace Xamarin package dependencies individually and not as a package.To resolve the problem

1. Open your Android or iOS&nbsp;`.csproj`&nbsp;file, and remove all Dynatrace Xamarin package&nbsp;`.dll`&nbsp;references. For example, remove the following code for iOS:

2. Add the Dynatrace Xamarin package reference to the&nbsp;`.csproj`&nbsp;file. Add the actual package version as the value of&nbsp;`<Version>`.

3. Rebuild your project.

## Turn off Visual Studio Debugger for Android

If you notice that Dynatrace doesn’t report crashes for Android applications to your environment, make sure that you’re not using the debug option in Visual Studio.

1. Right-click your Android project, and select&nbsp; **Properties**.

2. Go to&nbsp; **Android Options** , and clear&nbsp;**Enable developer instrumentation (debugging and profiling)**.

Keep in mind that clearing&nbsp; **Enable developer instrumentation** &nbsp;disables debugging. Use this option only to verify that crashes are sent. Optionally, you can create a release build that is detached from Visual Studio.

## Disposed&nbsp;`WebRequestTiming`&nbsp;object for Android

When you use the third-party&nbsp;[modernhttpclient](https://www.nuget.org/packages/modernhttpclient/)&nbsp;or&nbsp;[modernhttpclient-updated](https://www.nuget.org/packages/modernhttpclient-updated/)&nbsp;library together with SSL pinning via the&nbsp;`NativeMessageHandler`, the following exception might occur:

```markup
Cannot access a disposed object.
Object name: 'Dynatrace.Xamarin.Binding.Android.WebRequestTiming'.

```

To resolve this issue, change the default Mono Garbage Collector bridge implementation from&nbsp;`tarjan`&nbsp;to&nbsp;`new`. Check this&nbsp;[Microsoft blog post](https://devblogs.microsoft.com/xamarin/xamarin-android-garbage-collection-improvements/)&nbsp;to learn about different Garbage Collectors and understand how to change them via the&nbsp;`environment.txt`&nbsp;file.
