Search code examples
androidxamarinxamarin.androidandroid-fusedlocation

Xamarin Android preserve method from Linking


I'm using Google Fused Location API in my Xamarin app. It all works fine in Debug mode.
However, when I set it in Release Mode, with Linking enabled, it doesn't work on the device. I'm pretty sure that it is because of the linking.
How do I preserve the methods I'm using from the Fused Location API (like "RequestLocationUpdates")?
Thanks.


Solution

  • Unfortunately, you cannot link a single method from an assembly.

    If you didn't do so already, did you consider setting your linking conditions to Link SDK Assemblies in your Project Options? This will avoid that the packages you depend on are being optimised to reduce the application size. SDK assemblies on the other hand, such as the ones which comes with Xamarin.Android, will be optimised. Read more here.

    Otherwise, you can use link skipping which essentially allows you to define explicitly which SDKs you do not want to be optimised.