Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build with enabled proguard #240

Closed
dawidhyzy opened this issue Apr 18, 2017 · 17 comments
Closed

Unable to build with enabled proguard #240

dawidhyzy opened this issue Apr 18, 2017 · 17 comments

Comments

@dawidhyzy
Copy link

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
Copy link
Owner

sockeqwe commented Apr 18, 2017 via email

@dawidhyzy
Copy link
Author

dawidhyzy commented Apr 18, 2017

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

@sockeqwe
Copy link
Owner

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
Copy link

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

@sockeqwe
Copy link
Owner

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
Copy link

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
Copy link
Owner

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
Copy link

dimsuz commented Apr 25, 2017

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
Copy link

dimsuz commented Apr 25, 2017

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
Copy link

dimsuz commented Apr 25, 2017

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

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

in proguard-rules.pro

@sockeqwe sockeqwe reopened this Apr 25, 2017
@sockeqwe
Copy link
Owner

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
Copy link

dimsuz commented Apr 25, 2017

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:
sockeqwe/mosby-conductor#24

@dimsuz
Copy link

dimsuz commented Apr 25, 2017

Oops, copy paste error, updated my last message.

@sockeqwe
Copy link
Owner

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
Copy link

dimsuz commented Apr 25, 2017

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

@sockeqwe
Copy link
Owner

sockeqwe commented Apr 25, 2017 via email

@dimsuz
Copy link

dimsuz commented Apr 25, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants