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

Proguard will obfuscate class names. #117

Closed
wants to merge 1 commit into from
Closed

Proguard will obfuscate class names. #117

wants to merge 1 commit into from

Conversation

kkocel
Copy link

@kkocel kkocel commented Apr 5, 2014

Previous proguard example left class names unchouched.

Previous proguard example left class names unchouched.
@JakeWharton
Copy link
Owner

Wat. You have to include every annotation? Can't you wildcard it?

@kkocel
Copy link
Author

kkocel commented Apr 7, 2014

Willcarding is root cause of #104 See @imminent comments.

@JakeWharton
Copy link
Owner

Ugh, gross. I might move this to a separate page then.
On Apr 7, 2014 12:36 AM, "Christopher Kocel" notifications@github.com
wrote:

Willcarding is root cause of #104https://github.com/JakeWharton/butterknife/issues/104See
@imminent https://github.com/imminent comments.

Reply to this email directly or view it on GitHubhttps://github.com//pull/117#issuecomment-39702962
.

@JakeWharton
Copy link
Owner

Proguard runs after javac so does it actually matter if these annotations are stripped?

@JakeWharton
Copy link
Owner

Ah, we need the classes to not be renamed. Grrrooooosssssssss

}

-keepclasseswithmembernames class * {
@butterknife.OnItemLongClick <methods>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent is different.

@JakeWharton
Copy link
Owner

You're missing focus and checked changed listeners. This isn't a very scalable solution :(

@JakeWharton
Copy link
Owner

Will -keepattributes InnerClasses work instead? Ideally we could allow obfuscation so that the generated classes are just renamed the same A + A$$ViewInjector --> a + a$$ViewInjector. I'm sure that's far too much to ask.

Ideally no one would use ProGuard...

@imminent
Copy link
Contributor

imminent commented Apr 9, 2014

@JakeWharton ideally the code would automatically and flawlessly reduce
itself to be as compact and performant as possible when compiled, but all
we have now is ProGuard.
On Apr 7, 2014 10:15 PM, "Jake Wharton" notifications@github.com wrote:

Will -keepattributes InnerClasses work instead? Ideally we could allow
obfuscation so that the generated classes are just renamed the same A +
A$$ViewInjector --> a --> a$$ViewInjector. I'm sure that's far too much
to ask.

Ideally no one would use ProGuard...

Reply to this email directly or view it on GitHubhttps://github.com//pull/117#issuecomment-39812536
.

@mCloud
Copy link

mCloud commented Aug 4, 2014

index.html NOT publish to github.io? @JakeWharton

@jonreeve
Copy link
Contributor

jonreeve commented Aug 6, 2014

On the subject of wildcards, and not repeating for every new annotation, I found this works OK:

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

You might be tempted to go a step further, but this one does not work:

-keepclasseswithmembernames class * {
    @butterknife.* *;
}

So my full working config for ButterKnife now is this:

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}

Fairly short, and pretty scalable.

@JakeWharton
Copy link
Owner

Send a PR, please.

@jonreeve
Copy link
Contributor

#161

@JakeWharton
Copy link
Owner

I merged #161.

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

Successfully merging this pull request may close these issues.

None yet

5 participants