Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

ProGuard fails when using WorkManager #166

Open

Description

Xamarin.Android Version (eg: 6.0):

9.2.0.5 (HEAD/292d27fa)

Operating System & Version (eg: Mac OSX 10.11):

Windows 10 1809 (OS build 17763.437)

Support Libraries Version (eg: 23.3.0):

28.0.0.1

Describe your Issue:

Adding Xamarin.Android.Arch.Work.Runtime NuGet package causes ProGuard to fail.

Steps to Reproduce (with link to sample solution if possible):

  1. Enable ProGuard
  2. Add Xamarin.Android.Arch.Work.Runtime NuGet package
  3. Compile

Sample solution

Include any relevant Exception Stack traces, build logs, adb logs:

Output from Visual Studio 2019:

1>C:\Users\Trevor.nuget\packages\xamarin.android.arch.work.runtime\1.0.0\build....\proguard\proguard.txt : warning XA4304: Proguard configuration file 'C:\Users\Trevor.nuget\packages\xamarin.android.arch.work.runtime\1.0.0\build....\proguard\proguard.txt' was not found.
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find superclass or interface android.arch.paging.PositionalDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced method 'int computeInitialLoadPosition(android.arch.paging.PositionalDataSource$LoadInitialParams,int)' in program class android.arch.persistence.room.paging.LimitOffsetDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced method 'int computeInitialLoadSize(android.arch.paging.PositionalDataSource$LoadInitialParams,int,int)' in program class android.arch.persistence.room.paging.LimitOffsetDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadInitialCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeParams
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource$LoadRangeCallback
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource: can't find referenced class android.arch.paging.PositionalDataSource
1>PROGUARD : warning : android.arch.persistence.room.paging.LimitOffsetDataSource$1: can't find referenced method 'void invalidate()' in program class android.arch.persistence.room.paging.LimitOffsetDataSource
1>PROGUARD : warning : there were 27 unresolved references to classes or interfaces.
1>PROGUARD : warning : there were 4 unresolved references to program class members.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2662,3): error MSB6006: "java.exe" exited with code 1.

Activity

  1. changed the title [-]Xamarin.Android.Arch.Work.Runtime NuGet package breaks ProGuard[/-] [+]ProGuard fails when using WorkManager[/+] on Apr 30, 2019
  2. tranb3r commented on Sep 10, 2019

    @tranb3r

    Jonathan Dick (@Redth) Any progress on this issue ?

  3. ndastur commented on Sep 17, 2019

    @ndastur

    Adding these to your own proguard config seems to solve the problem

    -dontwarn android.arch.util.paging.CountedDataSource
    -dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource
    
  4. Redth commented on Sep 25, 2019

    @Redth
    Member

    Yep, generally those errors just require adding proguard warnings. Thanks for posting that Neville Dastur (@ndastur) !

  5. ndastur commented on Sep 25, 2019

    @ndastur

    Jonathan Dick (@Redth) the only thing I'd say is that the NuGET package should have the relevant proguard config included with it or at least something in the readme.

  6. Redth commented on Sep 25, 2019

    @Redth
    Member

    We ship whatever proguard rules exist in the .aar so I’m not sure why these rules would be missed, but apparently it was.

  7. ndastur commented on Sep 25, 2019

    @ndastur

    Thanks Jonathan Dick (@Redth) .. Yes, they do seem to be. I'm sure I've seen a build warning saying an expected proguard file is missing. Any idea about timeline on a fix?

  8. tranb3r commented on Sep 26, 2019

    @tranb3r

    Jonathan Dick (@Redth)
    I don't understand why this issue has been closed:

    • there is a warning, it should be fixed (warning XA4304: Proguard configuration file 'xxx.nuget\packages\xamarin.android.arch.work.runtime\1.0.0\build....\proguard\proguard.txt' was not found.
    • whatever missing rule should be added and shipped with the nuget
  9. Redth commented on Sep 30, 2019

    @Redth
    Member

    Thanks, I wasn't aware the file wasn't being properly included. Looking at this. I see why it's happening (it's only inside proguard/proguard.txt in the nupkg instead of in proguard/monoandroid90/proguard.txt which the .targets file expects). We'll get this fixed and release an update.

  10. ndastur commented on Sep 30, 2019

    @ndastur

    Brilliant. Thank you.

  11. tranb3r commented on Oct 1, 2019

    @tranb3r

    Thanks, I wasn't aware the file wasn't being properly included. Looking at this. I see why it's happening (it's only inside proguard/proguard.txt in the nupkg instead of in proguard/monoandroid90/proguard.txt which the .targets file expects). We'll get this fixed and release an update.

    Are you kidding me ? This ticket was opened several months ago and the warning is the first line of the stack trace, how could you not be aware of that ??

    Let me remind you that there are other issues concerning this package and waiting to be fixed: #204 #168

  12. Redth commented on Oct 3, 2019

    @Redth
    Member

    This should be fixed in this package update: https://www.nuget.org/packages/Xamarin.Android.Arch.Work.Runtime/1.0.0.3

    Please let us know if this resolves the problem.

  13. added
    needs-info
    on Oct 3, 2019
  14. thudugala commented on Oct 6, 2019

    @thudugala

    issue is fixed

  15. tranb3r commented on Oct 7, 2019

    @tranb3r

    No more warnings but I still need to add some rules to my proguard.cfg in order for it to work.

  16. removed
    needs-info
    on Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions