回答編集履歴

3

誤字の修正

2017/10/19 12:07

投稿

hiramekun
hiramekun

スコア428

test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  自分もaws関連の時にここで苦労した覚えがあります。
18
18
 
19
- 質問者様の場合だとgsonは個別の設定があります。[こちらにっています](https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg)。
19
+ 質問者様の場合だとgsonは個別の設定があります。[こちらにっています](https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg)。
20
20
 
21
21
 
22
22
 
@@ -36,6 +36,10 @@
36
36
 
37
37
  }
38
38
 
39
+ ```
40
+
41
+
42
+
39
43
  ---
40
44
 
41
45
  参考になればと思い、自分のプロガードファイルを載せておきます。

2

追記しました

2017/10/19 12:07

投稿

hiramekun
hiramekun

スコア428

test CHANGED
@@ -1,3 +1,5 @@
1
+ ## 1
2
+
1
3
  まず、直接関係はないかもしれませんが、[こちらの公式ドキュメント](https://developer.android.com/studio/build/shrink-code.html?hl=ja)はお読みになられましたか?
2
4
 
3
5
  自分も難読化を組み込んだことがありますが、`useProguard`のようなプロパティは今はないはずです。
@@ -8,6 +10,8 @@
8
10
 
9
11
 
10
12
 
13
+ ## 2
14
+
11
15
  keepしているものですが、使用しているライブラリのgithubを覗きに行かなければいけません。
12
16
 
13
17
  自分もaws関連の時にここで苦労した覚えがあります。
@@ -16,6 +20,22 @@
16
20
 
17
21
 
18
22
 
23
+ ## 3
24
+
25
+ Apkファイルをlogcatで確認する方法ですが、以下のように`debuggable true` を設定すると、apkファイルをダウンロードしたエミュレータもしくは実機をパソコンに繋げば、AndroidStudioのログで見ることができますよ。(とはいえ、難読化されているので解読は難しいと思いますが)
26
+
27
+ ```
28
+
29
+ debug {
30
+
31
+ minifyEnabled false
32
+
33
+ debuggable true
34
+
35
+ ...以下略
36
+
37
+ }
38
+
19
39
  ---
20
40
 
21
41
  参考になればと思い、自分のプロガードファイルを載せておきます。

1

参考に自分のファイルを載せました

2017/10/19 12:06

投稿

hiramekun
hiramekun

スコア428

test CHANGED
@@ -13,3 +13,181 @@
13
13
  自分もaws関連の時にここで苦労した覚えがあります。
14
14
 
15
15
  質問者様の場合だとgsonは個別の設定があります。[こちらに乗っていますね](https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg)。
16
+
17
+
18
+
19
+ ---
20
+
21
+ 参考になればと思い、自分のプロガードファイルを載せておきます。
22
+
23
+ ```
24
+
25
+ ## For Reflection
26
+
27
+ ## ここにリフレクションを使っている部分を記述しています。
28
+
29
+
30
+
31
+ ## See https://developer.android.com/guide/topics/resources/menu-resource.html, #actionViewClass.
32
+
33
+ -keep class android.support.v7.widget.SearchView { *; }
34
+
35
+
36
+
37
+ ## Local Warnings
38
+
39
+ # Classes which are part of JavaRunTime but not AndroidRunTime
40
+
41
+ # Java logging API
42
+
43
+ -dontwarn org.slf4j.**
44
+
45
+ -dontwarn jp.pickme.pickme.ui.board.community.diary.player.DiaryPlayerFragment$**
46
+
47
+
48
+
49
+ ## Retrofit
50
+
51
+ # https://github.com/square/retrofit
52
+
53
+ -dontwarn okio.**
54
+
55
+ -dontwarn javax.annotation.**
56
+
57
+
58
+
59
+ ## gms
60
+
61
+ -dontwarn com.google.android.gms.**
62
+
63
+ -dontwarn com.appsflyer.GcmInstanceIdListener
64
+
65
+
66
+
67
+ ## AWS
68
+
69
+ # https://github.com/aws/aws-sdk-android/blob/master/Proguard.md
70
+
71
+ # Class names are needed in reflection
72
+
73
+ -keepnames class com.amazonaws.**
74
+
75
+ -keepnames class com.amazon.**
76
+
77
+ # Request handlers defined in request.handlers
78
+
79
+ -keep class com.amazonaws.services.**.*Handler
80
+
81
+ # The following are referenced but aren't required to run
82
+
83
+ -dontwarn com.fasterxml.jackson.**
84
+
85
+ -dontwarn org.apache.commons.logging.**
86
+
87
+ # Android 6.0 release removes support for the Apache HTTP client
88
+
89
+ -dontwarn org.apache.http.**
90
+
91
+ # The SDK has several references of Apache HTTP client
92
+
93
+ -dontwarn com.amazonaws.http.**
94
+
95
+ -dontwarn com.amazonaws.metrics.**
96
+
97
+
98
+
99
+ ## Glide
100
+
101
+ # https://github.com/bumptech/glide#proguard
102
+
103
+ -keep public class * implements com.bumptech.glide.module.GlideModule
104
+
105
+ -keep public class * extends com.bumptech.glide.AppGlideModule
106
+
107
+ -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
108
+
109
+ **[] $VALUES;
110
+
111
+ public *;
112
+
113
+ }
114
+
115
+
116
+
117
+ ## Jackson
118
+
119
+ # github.com/FasterXML/jackson-docs/wiki/JacksonOnAndroid
120
+
121
+ -keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; }
122
+
123
+ -keep class com.fasterxml.** { *; }
124
+
125
+ -keep class org.codehaus.** { *; }
126
+
127
+ -keepnames class com.fasterxml.jackson.** { *; }
128
+
129
+ -keepclassmembers public final enum com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility {
130
+
131
+ public static final com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility *;
132
+
133
+ }
134
+
135
+
136
+
137
+ ## Gson
138
+
139
+ # Gson uses generic type information stored in a class file when working with fields. Proguard
140
+
141
+ # removes such information by default, so configure it to keep all of it.
142
+
143
+ # https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
144
+
145
+ -keepattributes Signature
146
+
147
+ # For using GSON @Expose annotation
148
+
149
+ -keepattributes *Annotation*
150
+
151
+ # Gson specific classes
152
+
153
+ -keep class sun.misc.Unsafe { *; }
154
+
155
+ # Application classes that will be serialized/deserialized over Gson
156
+
157
+ -keep class com.google.gson.examples.android.model.** { *; }
158
+
159
+ # Prevent proguard from stripping interface information from TypeAdapterFactory,
160
+
161
+ # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
162
+
163
+ -keep class * implements com.google.gson.TypeAdapterFactory
164
+
165
+ -keep class * implements com.google.gson.JsonSerializer
166
+
167
+ -keep class * implements com.google.gson.JsonDeserializer
168
+
169
+
170
+
171
+ ## Rx
172
+
173
+ # https://github.com/artem-zinnatullin/RxJavaProGuardRules/blob/master/rxjava-proguard-rules/proguard-rules.txt
174
+
175
+ -dontwarn sun.misc.Unsafe
176
+
177
+ -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
178
+
179
+ long producerIndex;
180
+
181
+ long consumerIndex;
182
+
183
+ }
184
+
185
+ -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
186
+
187
+ long producerNode;
188
+
189
+ long consumerNode;
190
+
191
+ }
192
+
193
+ ```