sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

Unable to build with enabled proguard #240

Closed dawidhyzy closed 7 years ago

dawidhyzy commented 7 years ago

Mosby Version: 3.0.2

Expected behavior Should build with proguard

Actual behavior (include a stacktrace if crash) Not building with proguard:

Warning:com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning:com.hannesdorfmann.mosby3.PresenterManager: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning:com.hannesdorfmann.mosby3.mvp.delegate.ViewGroupMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning:com.hannesdorfmann.mosby3.mvp.delegate.ActivityMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning:there were 4 unresolved references to classes or interfaces.

Steps to reproduce the behavior or link to a sample repository Build with enabled proguard

sockeqwe commented 7 years ago

Thanks for reporting. Are you trying to build your own app or one of the sample apps in this repository?

Dawid Hyży notifications@github.com schrieb am Di., 18. Apr. 2017, 16:32:

Mosby Version: 3.0.2

Expected behavior Should build with proguard

Actual behavior (include a stacktrace if crash) Not building with proguard:

Warning:com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings Warning:com.hannesdorfmann.mosby3.PresenterManager: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings Warning:com.hannesdorfmann.mosby3.mvp.delegate.ViewGroupMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings Warning:com.hannesdorfmann.mosby3.mvp.delegate.ActivityMvpDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings Warning:there were 4 unresolved references to classes or interfaces.

Steps to reproduce the behavior or link to a sample repository Build with enabled proguard

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sockeqwe/mosby/issues/240, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjnrnhAaAtPPx46Dp0sysUWN3v6I7_wks5rxMl4gaJpZM4NAbdd .

dawidhyzy commented 7 years ago

My app, which I migrated from Mosby 2.0. It has few classes which implements Activity(Fragment)MvpDelegateImpl.

sockeqwe commented 7 years ago

I will take a closer look at it on Thursday. This annotation should be part of the aar at all (should only be used during compile time).

StephaneBg commented 7 years ago

Hello, I can confirm that I have exactly the same issue when I try to release my app with Proguard.

sockeqwe commented 7 years ago

Ok, this should be fixed with latest 3.0.3-SNAPSHOT (see readme of how to use snapshot).

Could you please verify that this fixes the proguard problem? Then I will gladly release it as 3.0.3

StephaneBg commented 7 years ago

I've just tried it and it worked fine. Thanks for the quick workaround and the library of course! Do you plan to release a new version soon?

sockeqwe commented 7 years ago

3.0.3 has been released a minute ago. Should be available soon (may take some more minutes to sync it to maven central)

Thanks for your help!

dimsuz commented 7 years ago

Hmm. I have just set up my (new) project to use 3.0.3 and proguard fails with the message mentioned in this issue... It seems like it is not fixed, dunno why:

Warning: com.hannesdorfmann.mosby3.mvp.delegate.ActivityMvpViewStateDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning: com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpViewStateDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
Warning: com.hannesdorfmann.mosby3.mvp.delegate.ViewGroupMvpViewStateDelegateImpl: can't find referenced class edu.umd.cs.findbugs.annotations.SuppressFBWarnings
dimsuz commented 7 years ago

Ah! That's now coming through a viewstate module, which was implicitly added as a dependency by mvp-conductor which I am using. So this issue should be reopened I guess :)

dimsuz commented 7 years ago

As a workaround until new version is released, one can use

-dontwarn com.hannesdorfmann.mosby3.mvp.delegate.**

in proguard-rules.pro

sockeqwe commented 7 years ago

Hm, so @dimsuz you are saying that you still see the error in your project with mosby conductor if you specify the versions like this:

  compile 'com.hannesdorfmann.mosby3:viewstate-conductor:3.0.0'
  compile 'com.hannesdorfmann.mosby3:viewstate:3.0.3'
dimsuz commented 7 years ago

Not exactly. I use only:

compile 'com.hannesdorfmann.mosby3:mvp-conductor:3.0.0'

and it transitively adds dependency on mosby-mvp-lce which seems to cause build failing. I created a separate issue/question for this implicit dependency addition: https://github.com/sockeqwe/mosby-conductor/issues/24

dimsuz commented 7 years ago

Oops, copy paste error, updated my last message.

sockeqwe commented 7 years ago

You are right, it should work if you add those 2 transitive dependencies explicitly:

  compile 'com.hannesdorfmann.mosby3:viewstate-conductor:3.0.0'
  compile 'com.hannesdorfmann.mosby3:viewstate:3.0.3'
  compile 'com.hannesdorfmann.mosby3:mvp:3.0.3'
dimsuz commented 7 years ago

I will try a bit later today and report! When I add them explicitly those annotations will be filtered out? (Just curious)

sockeqwe commented 7 years ago

In 3.0.3 I have removed this annotation at all, so that they are no longer bundled in 3.0.3. Therefore I expect that explicitly adding the 3.0.3 dependency forces mosby-conductor to use 3.0.3 internally and that the issue should be fixed.

dimsuz notifications@github.com schrieb am Di., 25. Apr. 2017, 21:38:

I will try a bit later today and report! When I add them explicitly those annotations will be filtered out? (Just curious)

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/sockeqwe/mosby/issues/240#issuecomment-297141842, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjnrn1orpceTcZ24g4zcG1xPSooHAZAks5rzkvJgaJpZM4NAbdd .

dimsuz commented 7 years ago

OK, it was enough to just add

compile 'com.hannesdorfmann.mosby3:viewstate:3.0.3'

Disregard my last question, I didn't notice that you suggested to just explicitly specify 3.0.3 for other artifacts. My current setup used 3.0.3 for mvp but 3.0.0 for a viewstate (transitively) which caused troubles.

Thanks for helping to sort this out! Issue solved (can't close it, no rights)