• Stars
    star
    172
  • Rank 220,317 (Top 5 %)
  • Language
    Java
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

proguard-annotations AAR

proguard-annotations

Android Arsenal JitPack Download javadoc.io Build Status Join the chat at https://gitter.im/yongjhih/proguard-annotations

proguard-annotations

Easy to use inline @Keep annotation to keep class.

And easy to install.

Usage

@Keep
@KeepClassMembers
public class KeepMe {
    String keepMe;
}

Installation

build.gradle:

dependencies {
    compile "com.infstory:proguard-annotations:1.0.2"
}

Annotations

javadoc.io

How annotations do? proguard-annotations/annotations.pro

See Also

Import from official proguard/examples/annotations/src/proguard/annotation

ref. http://proguard.sourceforge.net/manual/examples.html#annotated

Test

$ /gradelw clean assembleRelease
$ cd proguard-annotations-app/build/outputs/apk
$ unzip proguard-annotations-app-release-unsigned.apk
$ dex2jar classes.dex
$ unzip classes_dex2jar.jar
$ tree proguard
proguard
β”œβ”€β”€ annotation
β”‚Β Β  β”œβ”€β”€ BuildConfig.class
β”‚Β Β  β”œβ”€β”€ KeepApplication.class
β”‚Β Β  β”œβ”€β”€ Keep.class
β”‚Β Β  β”œβ”€β”€ KeepClassMemberNames.class
β”‚Β Β  β”œβ”€β”€ KeepClassMembers.class
β”‚Β Β  β”œβ”€β”€ KeepGettersSetters.class
β”‚Β Β  β”œβ”€β”€ KeepImplementations.class
β”‚Β Β  β”œβ”€β”€ KeepName.class
β”‚Β Β  β”œβ”€β”€ KeepPublicClassMemberNames.class
β”‚Β Β  β”œβ”€β”€ KeepPublicClassMembers.class
β”‚Β Β  β”œβ”€β”€ KeepPublicGettersSetters.class
β”‚Β Β  β”œβ”€β”€ KeepPublicImplementations.class
β”‚Β Β  β”œβ”€β”€ KeepPublicProtectedClassMemberNames.class
β”‚Β Β  └── KeepPublicProtectedClassMembers.class
└── app
    β”œβ”€β”€ KeepMe.class
    └── KeepMeWithoutMembers.class

$ jd-gui classes_dex2jar.jar # Optional
$ tree proguard-annotations-app/src/main/java
proguard-annotations-app/src/main/java
└── proguard
    └── app
        β”œβ”€β”€ DontKeepMe.java
        β”œβ”€β”€ KeepMe.java
        └── KeepMeWithoutMembers.java

TODO

  • Test Cases

FAQ

For which classes I have to use it ? Only classes i made for my items ? Or also activities and services and so on?

It used to apply on reflection target. If you have not use relection, you just enable minify feature with default proguard config by the following build.gradle, and do nothing with proguard config:

android {
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }
}

When to use @Keep and when to use @KeepClassMembers ?

@Keep used to apply on runtime annotation for relection, it will keep class name and avoid be removed for optimization. @KeepClassMembers used to keep whole class with class members for POJO reflection. It's used to keep targets for Gson and Jackson JSON reflection libraries.

I don't need to write anything in my proguard rule file ? For my application or libraries or jars ?

Yes, do nothing if nothing special. Just enable minify.

See Also

Android Support Annotations - Keep

In progress:

@Keep

We've also added @Keep to the support annotations. Note however that > that annotation hasn't been hooked up to the Gradle plugin yet (though > it's in progress.) When finished this will let you annotate methods and > > classes that should be retained when minimizing the app.

[License] (LICENSE)

The MIT License (MIT)

Copyright (c) 2014 Andrew Chen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

android-proguards

AAR proguards
Java
762
star
2

docker-parse-server

Provide docker images and docker stack for parse-server npm versions and latest commit
JavaScript
475
star
3

android-gitbook

Open Android
CSS
207
star
4

RetroFacebook

Retrofit Facebook Android SDK
Java
192
star
5

RxParse

Reactive Parse
Java
140
star
6

kotlin-extensions

kotlin-android-extensions
Kotlin
127
star
7

mocker

Fluent mockito
Java
97
star
8

awesome-android-awesomeness

A curated list of android awesomeness
84
star
9

SwitchPreferenceCompat

SwitchPreferenceCompat from https://plus.google.com/+ChristianGollner/posts/badausxo1J6
Java
43
star
10

mismeter

A Simple Meter View for Android
Java
39
star
11

RxBolts

Reactive Bolts-Android Framework
Java
32
star
12

rxfirebase

RxJava2 and Kotlin for Firebase
Java
30
star
13

AutoJson

AutoLoganSquare = AutoValue + LoganSquare
Java
29
star
14

pepk

PEPK - Play Encrypt Private Key - Imported from pepk-src.jar
Java
29
star
15

CardView

CardView v7 for eclipse
Java
27
star
16

RecyclerList

Easy to use RecyclerView
Java
27
star
17

depth

Depth Menu for Android: REDIRECT to
27
star
18

dagger2-sample

CoffeeMaker Sample
Java
27
star
19

auto-parse

AutoValue for ParseObject
Java
26
star
20

RxMediaStore

RxMediaStore
Java
26
star
21

AutoCursor

AutoCursor
Java
25
star
22

squery

8Query - Query Builder
Java
24
star
23

JavaPoetic

JavaPoet Simple Builder
Java
23
star
24

docker-android-studio

Shell
21
star
25

drupalfit

A drupal services rest client with retrofit for android
Java
21
star
26

RxFacebook

Facebook in RxJava
Java
19
star
27

rx-mqtt

Java
18
star
28

rx-receiver

RxJava1/2 for Android BroadcastReceiver
Java
16
star
29

android-gradle-plugin

Import from aosp https://android.googlesource.com/platform/tools/base
Java
15
star
30

rc

rcfiles/dotfiles
Perl
13
star
31

flutter_childed

Avoid Widget Hell
Dart
6
star
32

parse-cloud-code

Allow signInWithTwitch for Parse Cloud Code
JavaScript
6
star
33

docker-android

Dockerfile
6
star
34

docker-alpine-android

6
star
35

parse-android-sdk

parse.com android-sdk
Shell
6
star
36

RxList

Reactive List
Java
5
star
37

rxtasks

RxTasks for GMS
Java
5
star
38

flutter_aws

Amazon Pinpoint SDK for flutter
Kotlin
5
star
39

converter-logansquare-retrofit

Converter LoganSquare for retrofit
Java
4
star
40

rx-net

Reactive network for Android
Java
4
star
41

retrofit2.bak

Retrofit2 turns your REST API into a Java interface
Java
4
star
42

HealingBrush

git clone https://android.googlesource.com/platform/frameworks/rs.git
Java
4
star
43

discord-tts-bot

discord tts bot
Python
4
star
44

simple-parse

No more put("key", value)
Java
3
star
45

parse-android-sdk.m2

From https://github.com/8tory/parse-android-sdk
3
star
46

attrs-view

Java
3
star
47

RxJava-Operators

Java
3
star
48

rxjava2-sample

2
star
49

flutter_play_licensing

For flutter, https://github.com/google/play-licensing
Kotlin
2
star
50

ActiveAndroid-Preference

Allow Preference using ActiveAndroid ORM to persist settings
Java
2
star
51

aws-ktx

Kotlin
2
star
52

fh2py

Battlefild2 FH2 python
Python
2
star
53

aoe2-aoc-1.0c-scenario

=_=|||ε ‘δ»”
2
star
54

routs

Simple Router with Prefix Tree
Java
2
star
55

RxJava2RxJava2

2
star
56

kotlin-system-services

[Deprecated]
Kotlin
2
star
57

mender-python

Mender SDK for python
Python
2
star
58

RxJava-retrofit-github-sample

Sample for https://speakerdeck.com/jakewharton/2014-1
Java
2
star
59

android-ui-example

markushi/android-ui example
Java
2
star
60

docker-mosquitto

Shell
1
star
61

docker-dex2jar

Shell
1
star
62

resources

1
star
63

gradle-java-test-boilerplate

Java
1
star
64

rx-facebook-sdk.js

rxjs for facebook sdk
JavaScript
1
star
65

retromqtt

1
star
66

docker-elasticsearch-logstash-kibana

docker-ELK
1
star
67

facebook-content-provider

FacebookContentProvider supports picture
Java
1
star
68

lolrtmpsclient

Automatically exported from code.google.com/p/lolrtmpsclient
Java
1
star
69

android-system-services

Easy to retrieve system service
Java
1
star
70

docker-webdis

Shell
1
star
71

flutter_embrace

Dart
1
star
72

bf2py

Battlefild2 python
Python
1
star
73

RetroFirebase

1
star
74

android-sdk-maven

mirror android sdk local maven
1
star
75

docker-aosp

Provides AOSP build environment
Shell
1
star
76

android-facebook-stickers

1
star
77

rx-websocket.js

JavaScript
1
star
78

assertj-rxjava2

TODO
1
star
79

parse-facebook-v3

Parse Facebook Android SDK
Shell
1
star
80

flutter_ext

A set of Dart extensions for Flutter development
Dart
1
star
81

bloctog

1
star
82

docker-logstash-webdis

ELKRW
1
star
83

android-gradle-plugin.m2

maven repo for https://github.com/yongjhih/android-gradle-plugin
1
star
84

rx-telephony

Java
1
star
85

rx-twitch.js

JavaScript
1
star
86

screenshot-tests-for-android-boilerplate

Kotlin
1
star
87

open-webook

1
star
88

docker-alpine-openjdk

1
star
89

RxJava-GroupByTest

Java
1
star
90

streamsupport-snapshot

Backport of Java 8 java.util.stream API to Java 6/7 and Android [Deprecated]
Java
1
star
91

ParseCompat

Compatable Parse
Java
1
star
92

gwtwiki

git-svn http://gwtwiki.googlecode.com/svn/
Java
1
star
93

RxAutoParcel

1
star
94

mender-material

JavaScript
1
star
95

docker-flutter

Dockerfile
1
star
96

android-material-arsenal

1
star
97

gradle-init.rxjava

Java
1
star
98

simple-processor

1
star
99

docker-gradle

Install gradle wrapper by docker container
Shell
1
star
100

android-i18n-plurals

Java
1
star