2

I'm working on a Xamarin Forms app for Android and iOS. We use a third-party SDK that comes as an .aar package, build action set to LibraryProjectZip. Then, we have calls from the forms, the iOS, and the Android parts of the code. Linking works just fine in debug mode if I remember correctly.

I'm failing to get the Linker+ProGuard work together. I've read for days and experimented with numerous solutions. I was having java codes 1 and 2 - so I updated ProGuard and it started working. Then Linking was producing errors - UnauthorizedAccessException so I had to go to the respective folder and remove the ReadOnly permission. Then the project is built successfully but the app functionality is lost even though it runs and in Device Log I can see that some classes are missing.

To fix that, I created a ProGuard.cfg and added most of the assemblies that were crashing with the "-keep" command. However, I can't seem to find a way to preserve the functionality from this .aar package

Any suggestions?

I'm using VS 2017 and Xamarin 7.4 on Windows 10 with JDK 1.8, running as Administrator. Tried linking Sdk Assemblies / User&Sdk Assemblies. Multidex is on. I've tried putting the names of the assemblies of all the projects in the Skip Linking Assemblies field, no results. In the device log, I get a package name for the call that is failing so I tried adding this to ProGuard too but it didn't help. (it looked like "-keep class com.something.something")

Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
iBobb
  • 1,140
  • 1
  • 14
  • 35
  • actually what helped me was searching for a proguard config file which is a more general one, stopping the linker from deleting some commonly used Android libraries let's say...combined with some of the things I found by looking at the errors, I got it working. – iBobb Jan 16 '18 at 16:12
  • I know it might not be exactly a solution to the problem I originally mentioned but actually we are not using ProGuard anymore. This is not recommended by many people but in Xamarin it is not obfuscating code anyway and I needed it mainly for the app size reduction. However, after getting rid of the old architectures I was supporting - x86, armeabi and x86_64, the package was small enough. – iBobb Oct 24 '19 at 10:30

1 Answers1

1

I can't comment, but this blog post may be of use.

"The Linker Analyzer is a command line tool that analyzes dependencies which are recorded during the LinkAssemblies step. It will show you what items were marked and resulted in the linked assembly."

https://www.jon-douglas.com/2017/09/22/linker-analyzer/

c.lamont.dev
  • 693
  • 1
  • 6
  • 14